diff --git a/.github/deployment/self-host/compose.yaml b/.github/deployment/self-host/compose.yaml index dc16d7c8f..9cdac96be 100644 --- a/.github/deployment/self-host/compose.yaml +++ b/.github/deployment/self-host/compose.yaml @@ -30,6 +30,9 @@ services: - NODE_ENV=production - AFFINE_ADMIN_EMAIL=${AFFINE_ADMIN_EMAIL} - AFFINE_ADMIN_PASSWORD=${AFFINE_ADMIN_PASSWORD} + # Telemetry allows us to collect data on how you use the affine. This data will helps us improve the app and provide better features. + # Uncomment next line if you wish to quit telemetry. + # - TELEMETRY_ENABLE=false redis: image: redis container_name: affine_redis diff --git a/packages/backend/server/src/config/affine.env.ts b/packages/backend/server/src/config/affine.env.ts index e0e3f0799..d069be52d 100644 --- a/packages/backend/server/src/config/affine.env.ts +++ b/packages/backend/server/src/config/affine.env.ts @@ -36,4 +36,5 @@ AFFiNE.ENV_MAP = { 'featureFlags.syncClientVersionCheck', 'boolean', ], + TELEMETRY_ENABLE: ['telemetry.enabled', 'boolean'], }; diff --git a/packages/backend/server/src/core/config.ts b/packages/backend/server/src/core/config.ts index 01830f11e..e34ee1dc5 100644 --- a/packages/backend/server/src/core/config.ts +++ b/packages/backend/server/src/core/config.ts @@ -66,6 +66,9 @@ export class ServerConfigType { description: 'credentials requirement', }) credentialsRequirement!: CredentialsRequirementType; + + @Field({ description: 'enable telemetry' }) + enableTelemetry!: boolean; } export class ServerConfigResolver { @@ -87,6 +90,7 @@ export class ServerConfigResolver { credentialsRequirement: { password: AFFiNE.auth.password, }, + enableTelemetry: AFFiNE.telemetry.enabled, }; } } diff --git a/packages/backend/server/src/fundamentals/config/default.ts b/packages/backend/server/src/fundamentals/config/default.ts index 34a5a4f78..d4ff5b1f8 100644 --- a/packages/backend/server/src/fundamentals/config/default.ts +++ b/packages/backend/server/src/fundamentals/config/default.ts @@ -188,7 +188,7 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => { enabled: false, }, telemetry: { - enabled: isSelfhosted && !process.env.DISABLE_SERVER_TELEMETRY, + enabled: isSelfhosted, token: '389c0615a69b57cca7d3fa0a4824c930', }, plugins: {