Skip to content

Commit

Permalink
Add feature flag for posthog support
Browse files Browse the repository at this point in the history
We want to run posthog only on prod environment.
  • Loading branch information
r-czajkowski committed Oct 5, 2022
1 parent 2edfdf9 commit 3e20249
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS

REACT_APP_FEATURE_FLAG_TBTC_V2=false
REACT_APP_FEATURE_FLAG_MULTI_APP_STAKING=true
REACT_APP_FEATURE_FLAG_POSTHOG=false
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ REACT_APP_ETH_HOSTNAME_WS=$ETH_HOSTNAME_WS

REACT_APP_FEATURE_FLAG_TBTC_V2=false
REACT_APP_FEATURE_FLAG_MULTI_APP_STAKING=true
REACT_APP_FEATURE_FLAG_POSTHOG=$POSTHOG_SUPPORT
1 change: 1 addition & 0 deletions .github/workflows/dashboard-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
CHAIN_ID: 1
ETH_HOSTNAME_HTTP: ${{ secrets.MAINNET_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.MAINNET_ETH_HOSTNAME_WS }}
POSTHOG_SUPPORT: true

- uses: actions/upload-artifact@v3
with:
Expand Down
5 changes: 4 additions & 1 deletion src/constants/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { EnvVariable } from "../enums"
import { getEnvVariable } from "../utils/getEnvVariable"
import { getEnvVariable, supportedChainId } from "../utils/getEnvVariable"

export const TBTC_V2 =
getEnvVariable(EnvVariable.FEATURE_FLAG_TBTC_V2) === "true"
export const MULTI_APP_STAKING =
getEnvVariable(EnvVariable.FEATURE_FLAG_MULTI_APP_STAKING) === "true"
export const POSTHOG =
getEnvVariable(EnvVariable.FEATURE_FLAG_POSTHOG) === "true" &&
supportedChainId === "1"
1 change: 1 addition & 0 deletions src/enums/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export enum EnvVariable {
ETH_HOSTNAME_WS = "ETH_HOSTNAME_WS",
FEATURE_FLAG_TBTC_V2 = "FEATURE_FLAG_TBTC_V2",
FEATURE_FLAG_MULTI_APP_STAKING = "FEATURE_FLAG_MULTI_APP_STAKING",
FEATURE_FLAG_POSTHOG = "FEATURE_FLAG_POSTHOG",
}
3 changes: 3 additions & 0 deletions src/utils/getEnvVariable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const envMap: { [key in EnvVariable]: string } = {
[EnvVariable.FEATURE_FLAG_MULTI_APP_STAKING]: process.env[
"REACT_APP_FEATURE_FLAG_MULTI_APP_STAKING"
] as string,
[EnvVariable.FEATURE_FLAG_POSTHOG]: process.env[
"REACT_APP_FEATURE_FLAG_POSTHOG"
] as string,
}

export const getEnvVariable = (envVar: EnvVariable) => {
Expand Down

0 comments on commit 3e20249

Please sign in to comment.