New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc Site: Environment variable flag #84
Comments
work remaining: need to test this on netlify |
the objective here is to make sure feature flags (for documentation) & secrets (for algolia search) work as expected in netlify's 3 standard contexts. check the browser console in these links - no UI changes made in this branch. example console log for branch deploy:
|
Tested all 3 links above:
Need to check with @samrichca if this is intentional or a bug. Even if intentional, this does not allow me to test that the flag actually suppresses the doc menu (or not) |
@b-f-chan no menu visible on this branch, it sounds like you got the right result! |
Confirmed with @samrichca, since intentional, we'll test actual megamenu visibility in #46 This ticket is verified, can be closed |
Problem
I was adding for a feature flag for the Documentation section, and discovered that using a simple
localStorage
flag isn't appropriate in this case:window.localStorage
is becausewindow
doesn't exist on the server. Window is not defined gatsbyjs/gatsby#309localStorage
flag oncomponentDidMount
or other hacks will probably not create a seamless experience, and could be complicated to remove later.Solution
Gatsby and Netlify have built-in support for environment variables.
https://docs.netlify.com/configure-builds/environment-variables/
https://www.gatsbyjs.com/docs/environment-variables/
Proposal
GATSBY_DOCS
env variable.GATSBY_DOCS=true
when...netlify deploy
(i.e. creating Netlify links for QA)GATSBY_DOCS=true gatsby build && gatsby serve
(local)GATSBY_DOCS=false
when...netlify deploy --prod
(i.e. deploying to overture.bio)gatsby build && gatsby serve
(local)The text was updated successfully, but these errors were encountered: