Skip to content

How to access Environment Variables? #1737

Answered by mythmon
jaspercroome asked this question in Q&A
Discussion options

You must be logged in to vote

Environment variables are available in data loaders and page loaders using the standard language features. For example, in a JavaScript data loader you can access environment variables with process.env, and in Python you could use os.environ. Environment variables are not directly accessible on Markdown files, or the JS files they import the run in the browser, since browsers don't have environment variables.

If you want to have the kind of configuration you are looking for, one option would be to generate the page with a page loader. That could read the environment variables and embed them in the generated page.

Another option would be to have a data loader that reads all the environment…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jaspercroome
Comment options

Answer selected by jaspercroome
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants