Skip to content

Commit

Permalink
refactor: put user id as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
gndz07 committed Mar 18, 2024
1 parent 34e0136 commit a9a6168
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
POLLING_INTERVAL=300000
REACT_APP_POLLING_INTERVAL=300000
REACT_APP_DOCWHIZZ_TRAEFIK_EE_USER_ID=
REACT_APP_DOCWHIZZ_TRAEFIK_PROXY_USER_ID=
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function App({ product }: { product?: string }) {
return (
<SWRConfig
value={{
refreshInterval: process.env.POLLING_INTERVAL ? parseInt(process.env.POLLING_INTERVAL, 10) : 300000, // default 5min
refreshInterval: process.env.REACT_APP_POLLING_INTERVAL ? parseInt(process.env.REACT_APP_POLLING_INTERVAL, 10) : 300000, // default 5min
fetcher,
}}
>
Expand Down
6 changes: 3 additions & 3 deletions src/components/nav/useDocWhizzScript.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const WHITELISTED_HOSTNAME = ['localhost', 'doc.traefik.io']
const useDocWhizzScript = () => {
const { pathname, hostname } = window.location
const product = pathname.split('/')[1]

console.log(process.env.REACT_APP_DOCWHIZZ_TRAEFIK_PROXY_USER_ID)
const clientId = useMemo(() => {
if (WHITELISTED_HOSTNAME.includes(hostname)) {
if (product === 'traefik') return '65e8267d7714e3b11a5ce139'
if (product === 'traefik-enterprise') return '65f0e20984bd4dfcfe7e58a6'
if (product === 'traefik') return process.env.REACT_APP_DOCWHIZZ_TRAEFIK_PROXY_USER_ID
if (product === 'traefik-enterprise') return process.env.REACT_APP_DOCWHIZZ_TRAEFIK_EE_USER_ID

return null
}
Expand Down

0 comments on commit a9a6168

Please sign in to comment.