Managing config and secrets
The Supabase CLI uses a config file to manage local configuration. The file is supabase/config.toml or supabase/config.jsonc.
Since CLI 3.4.0, supabase init creates config.jsonc. A project with a config.toml keeps working without changes. To switch formats, see Config file formats.
Config reference
There are a wide variety of options available, which can be found in the CLI Config Reference.
For example, to enable the "Apple" OAuth provider for local development, add the following to your config file. Merge its keys into the entries your file already has instead of adding a second copy. Fill in your client ID and set SUPABASE_AUTH_EXTERNAL_APPLE_SECRET in your .env file, as described in Using secrets inside your config file:
[auth.external.apple]enabled = trueclient_id = ""secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"redirect_uri = "" # Overrides the default auth redirectUrl.{ "auth": { "external": { "apple": { "enabled": true, "client_id": "", "secret": "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)", "redirect_uri": "" // Overrides the default auth redirectUrl. } } }}Using secrets inside your config file
You can reference environment variables within your config file using the env() function. The CLI reads any values stored in an .env file at the root of your project directory. This is particularly useful for storing sensitive information like API keys, and any other values that you don't want to check into version control.
.├── .env├── .env.example└── supabase └── config.tomlDo NOT commit your .env into git. Be sure to configure your .gitignore to exclude this file.
For example, if your .env contained the following values:
GITHUB_CLIENT_ID=""GITHUB_SECRET=""Then you would reference them in your config file like this:
[auth.external.github]enabled = trueclient_id = "env(GITHUB_CLIENT_ID)"secret = "env(GITHUB_SECRET)"redirect_uri = "" # Overrides the default auth redirectUrl.{ "auth": { "external": { "github": { "enabled": true, "client_id": "env(GITHUB_CLIENT_ID)", "secret": "env(GITHUB_SECRET)", "redirect_uri": "" // Overrides the default auth redirectUrl. } } }}Going further
For more advanced secrets management workflows, including:
- Using dotenvx for encrypted secrets: Learn how to securely manage environment variables across different branches and environments
- Branch-specific secrets: Understand how to manage secrets for different deployment environments
- Encrypted configuration values: Use encrypted values directly in your config file
See the Managing secrets for branches section in our branching documentation, or check out the dotenvx example repository for a complete implementation.