1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00

Environment config

This commit is contained in:
Rory Powell 2022-06-06 15:27:29 +01:00
parent 14e9fb4505
commit 01e48b418f
9 changed files with 10 additions and 17 deletions

View file

@ -4,9 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
env: env:
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }} INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
POSTHOG_URL: ${{ secrets.POSTHOG_URL }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
jobs: jobs:

View file

@ -18,9 +18,9 @@ on:
workflow_dispatch: workflow_dispatch:
env: env:
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} # Posthog token used by ui at build time
POSTHOG_TOKEN: phc_mA8rLA1Flfs1MLgkDQnhYYGhD2s3VBupMvhHyED19bh
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }} INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
POSTHOG_URL: ${{ secrets.POSTHOG_URL }}
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
jobs: jobs:

View file

@ -18,9 +18,9 @@ on:
workflow_dispatch: workflow_dispatch:
env: env:
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} # Posthog token used by ui at build time
POSTHOG_TOKEN: phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }} INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
POSTHOG_URL: ${{ secrets.POSTHOG_URL }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}

View file

@ -91,7 +91,7 @@ globals:
budibaseEnv: PRODUCTION budibaseEnv: PRODUCTION
enableAnalytics: true enableAnalytics: true
sentryDSN: "" sentryDSN: ""
posthogToken: "" posthogToken: "phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS"
logLevel: info logLevel: info
selfHosted: "1" # set to 0 for budibase cloud environment, set to 1 for self-hosted setup selfHosted: "1" # set to 0 for budibase cloud environment, set to 1 for self-hosted setup
multiTenancy: "0" # set to 0 to disable multiple orgs, set to 1 to enable multiple orgs multiTenancy: "0" # set to 0 to disable multiple orgs, set to 1 to enable multiple orgs

View file

@ -1,20 +1,17 @@
import posthog from "posthog-js" import posthog from "posthog-js"
import { Events } from "./constants" import { Events } from "./constants"
//
export default class PosthogClient { export default class PosthogClient {
constructor(token, url) { constructor(token) {
this.token = token this.token = token
this.url = url
} }
init() { init() {
if (!this.token || !this.url) return if (!this.token) return
posthog.init(this.token, { posthog.init(this.token, {
autocapture: false, autocapture: false,
capture_pageview: true, capture_pageview: true,
api_host: this.url,
}) })
posthog.set_config({ persistence: "cookie" }) posthog.set_config({ persistence: "cookie" })

View file

@ -4,10 +4,7 @@ import IntercomClient from "./IntercomClient"
import SentryClient from "./SentryClient" import SentryClient from "./SentryClient"
import { Events, EventSource } from "./constants" import { Events, EventSource } from "./constants"
const posthog = new PosthogClient( const posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
process.env.POSTHOG_TOKEN,
process.env.POSTHOG_URL
)
const sentry = new SentryClient(process.env.SENTRY_DSN) const sentry = new SentryClient(process.env.SENTRY_DSN)
const intercom = new IntercomClient(process.env.INTERCOM_TOKEN) const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)

View file

@ -31,7 +31,6 @@ export default ({ mode }) => {
"process.env.INTERCOM_TOKEN": JSON.stringify( "process.env.INTERCOM_TOKEN": JSON.stringify(
process.env.INTERCOM_TOKEN process.env.INTERCOM_TOKEN
), ),
"process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL),
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN), "process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
}), }),
], ],

View file

@ -11,6 +11,7 @@ ENV PORT=4001
ENV COUCH_DB_URL=https://couchdb.budi.live:5984 ENV COUCH_DB_URL=https://couchdb.budi.live:5984
ENV BUDIBASE_ENVIRONMENT=PRODUCTION ENV BUDIBASE_ENVIRONMENT=PRODUCTION
ENV SERVICE=app-service ENV SERVICE=app-service
ENV POSTHOG_TOKEN=phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS
# copy files and install dependencies # copy files and install dependencies
COPY . ./ COPY . ./

View file

@ -22,5 +22,6 @@ EXPOSE 4001
ENV NODE_ENV=production ENV NODE_ENV=production
ENV CLUSTER_MODE=${CLUSTER_MODE} ENV CLUSTER_MODE=${CLUSTER_MODE}
ENV SERVICE=worker-service ENV SERVICE=worker-service
ENV POSTHOG_TOKEN=phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS
CMD ["./docker_run.sh"] CMD ["./docker_run.sh"]