Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

How to Insert Environment Variables in a JSON Config

8 replies
Last updated: Sep 29, 2021

How do you insert environment variables in a .json config?

Sep 27, 2021, 1:03 AM

I think we need some more context here… The value of the env var or the name of it to be resolved later?
One of the main things about using env vars is that they are not stored on disk.

Sep 27, 2021, 9:16 AM

For development I wanted to put it in a


Sep 27, 2021, 2:46 PM

I just don't want to store it in the .json file

Sep 27, 2021, 2:46 PM

Hey Max! What are you looking to put into an env file? There's some information on using env vars here , but I could possibly give you more specific advice if I knew more about the use case!

Sep 27, 2021, 5:25 PM

I don't want the tokens in a public repo

Sep 28, 2021, 9:35 PM

You'll have to use one of the methods described here if you're trying to obscure your tokens.

Sep 28, 2021, 11:28 PM

How do I do this with the .json config? Is there something I can do to add environment variables to a config?

Sep 29, 2021, 1:16 AM

has a key
which I want it to be a environment variable.

Sep 29, 2021, 1:27 AM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.