Skip to content

Commit

Permalink
Take POSTHOG env variables from repo secrets
Browse files Browse the repository at this point in the history
To be consistent with current approach. We want to maintain the same
style for any other external services the dashboard needs to communicate
with.
  • Loading branch information
r-czajkowski committed Oct 28, 2022
1 parent 94a7427 commit d532b76
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ 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
REACT_APP_POSTHOG_API_KEY=phc_5XMnBAeMVxZQhmBm6G0Kee5ujBOiUhGYIakUKfDhgs5
REACT_APP_POSTHOG_API_HOST=https://app.posthog.com
REACT_APP_POSTHOG_API_KEY=$POSTHOG_API_KEY
REACT_APP_POSTHOG_HOSTNAME_HTTP=$POSTHOG_HOSTNAME_HTTP
2 changes: 2 additions & 0 deletions .github/workflows/dashboard-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
ETH_HOSTNAME_HTTP: ${{ secrets.MAINNET_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.MAINNET_ETH_HOSTNAME_WS }}
POSTHOG_SUPPORT: true
POSTHOG_API_KEY: ${{ secrets.MAINNET_POSTHOG_API_KEY }}
POSTHOG_HOSTNAME_HTTP: ${{ secrets.MAINNET_POSTHOG_HOSTNAME_HTTP }}

- uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion src/enums/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export enum EnvVariable {
FEATURE_FLAG_TBTC_V2 = "FEATURE_FLAG_TBTC_V2",
FEATURE_FLAG_MULTI_APP_STAKING = "FEATURE_FLAG_MULTI_APP_STAKING",
FEATURE_FLAG_POSTHOG = "FEATURE_FLAG_POSTHOG",
POSTHOG_API_HOST = "POSTHOG_API_HOST",
POSTHOG_HOSTNAME_HTTP = "POSTHOG_HOSTNAME_HTTP",
POSTHOG_API_KEY = "POSTHOH_API_KEY",
}
2 changes: 1 addition & 1 deletion src/posthog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getEnvVariable } from "../utils/getEnvVariable"

export const init = () => {
const apiKey = getEnvVariable(EnvVariable.POSTHOG_API_KEY)
const apiHost = getEnvVariable(EnvVariable.POSTHOG_API_HOST)
const apiHost = getEnvVariable(EnvVariable.POSTHOG_HOSTNAME_HTTP)

if (!apiKey || !apiHost) {
throw new Error("Could not initilize posthog.")
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getEnvVariable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const envMap: { [key in EnvVariable]: string } = {
[EnvVariable.FEATURE_FLAG_POSTHOG]: process.env[
"REACT_APP_FEATURE_FLAG_POSTHOG"
] as string,
[EnvVariable.POSTHOG_API_HOST]: process.env[
"REACT_APP_POSTHOG_API_HOST"
[EnvVariable.POSTHOG_HOSTNAME_HTTP]: process.env[
"REACT_APP_POSTHOG_HOSTNAME_HTTP"
] as string,
[EnvVariable.POSTHOG_API_KEY]: process.env[
"REACT_APP_POSTHOG_API_KEY"
Expand Down

0 comments on commit d532b76

Please sign in to comment.