diff --git a/.github/workflows/build_on_master_merge.yml b/.github/workflows/build_on_master_merge.yml index ef235111..3d6aebac 100644 --- a/.github/workflows/build_on_master_merge.yml +++ b/.github/workflows/build_on_master_merge.yml @@ -48,6 +48,8 @@ jobs: run: | docker buildx build \ --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --build-arg REACT_APP_PUBLIC_POSTHOG_KEY=${{ secrets.REACT_APP_PUBLIC_POSTHOG_KEY }} \ + --build-arg REACT_APP_PUBLIC_POSTHOG_HOST=${{ secrets.REACT_APP_PUBLIC_POSTHOG_HOST }} \ --platform linux/amd64,linux/arm/v7 \ --tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend:master" \ --output "type=registry" ./ diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 191a931d..3b50620f 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -51,6 +51,8 @@ jobs: docker buildx build \ --cache-to "type=local,dest=/tmp/.buildx-cache" \ --platform linux/amd64,linux/arm/v7 \ + --build-arg REACT_APP_PUBLIC_POSTHOG_KEY=${{ secrets.REACT_APP_PUBLIC_POSTHOG_KEY }} \ + --build-arg REACT_APP_PUBLIC_POSTHOG_HOST=${{ secrets.REACT_APP_PUBLIC_POSTHOG_HOST }} \ --tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend:${{ env.RELEASE_TAG }}" \ --tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend:latest" \ --output "type=registry" ./ diff --git a/Dockerfile b/Dockerfile index 4a0a584f..75d29a42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,11 @@ COPY yarn.lock ./ RUN yarn install --production COPY . . +ARG REACT_APP_PUBLIC_POSTHOG_KEY +ARG REACT_APP_PUBLIC_POSTHOG_HOST + +ENV REACT_APP_PUBLIC_POSTHOG_KEY=$REACT_APP_PUBLIC_POSTHOG_KEY +ENV REACT_APP_PUBLIC_POSTHOG_HOST=$REACT_APP_PUBLIC_POSTHOG_HOST RUN yarn run build diff --git a/public/index.html b/public/index.html index 7f51f3a0..b5b4de16 100644 --- a/public/index.html +++ b/public/index.html @@ -31,13 +31,6 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Sphinx Community - diff --git a/src/index.tsx b/src/index.tsx index 1c36e051..86a17b7b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,18 +7,15 @@ import '@elastic/eui/dist/eui_theme_dark.css'; import 'bootstrap/dist/css/bootstrap.css'; import { appEnv } from './config/env'; -//const options = { -// api_host: process.env.REACT_APP_PUBLIC_POSTHOG_HOST -//}; const options = { - api_host: 'https://us.i.posthog.com' + api_host: process.env.REACT_APP_PUBLIC_POSTHOG_HOST }; if (appEnv.isTests) { ReactDOM.render(, document.getElementById('root')); } else { ReactDOM.render( - + , document.getElementById('root')