Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(server): adjust telemetry config (#6424)

EYHN366e0a4b6048
diff --git a/.github/deployment/self-host/compose.yaml b/.github/deployment/self-host/compose.yaml
index dc16d7c8fc..9cdac96be8 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 e0e3f0799b..d069be52de 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 01830f11e3..e34ee1dc51 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 34a5a4f78a..d4ff5b1f8f 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: {