From 07cf74d52f162addef85244df1a70a1375abc0ca Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Thu, 4 Aug 2022 18:13:29 +0800 Subject: [PATCH] fix: feature flag offline mode --- libs/datasource/feature-flags/README.md | 13 +++++++++++-- libs/datasource/feature-flags/src/config.ts | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/datasource/feature-flags/README.md b/libs/datasource/feature-flags/README.md index f5c59f4e13..7a04209c5d 100644 --- a/libs/datasource/feature-flags/README.md +++ b/libs/datasource/feature-flags/README.md @@ -2,7 +2,15 @@ ## Usage -- set provider +- Set token at environment variable + - The key can be obtained from the [Feature Flag Portal](https://portal.featureflag.co/account-settings/projects) + +```shell +# .env.local +AFFINE_FEATURE_FLAG_TOKEN=XXXXXXX +``` + +- Set provider ```tsx import { FeatureFlagsProvider } from '@toeverything/datasource/feature-flags'; @@ -42,7 +50,8 @@ const App = () => { **When entering development mode feature flag will NOT be updated in real time** -- `activateFfcDevMode()` play with feature flags locally +- `activateFfcDevMode(PASSWORD)` play with feature flags locally + - The `devModePassword` can be obtained from `src/config.ts` - `quitFfcDevMode()` quit dev mode ## Running unit tests diff --git a/libs/datasource/feature-flags/src/config.ts b/libs/datasource/feature-flags/src/config.ts index 7f3360d6db..b89a2e7359 100644 --- a/libs/datasource/feature-flags/src/config.ts +++ b/libs/datasource/feature-flags/src/config.ts @@ -8,4 +8,5 @@ export const config: IOption = { // id: 'the user's unique identifier' // } devModePassword: '-', + enableDataSync: !!process.env['AFFINE_FEATURE_FLAG_TOKEN'], };