cli
cli copied to clipboard
Support boolean in Config.toml env substitution
Describe the bug
env
isn't working for some config.toml keys for example enabled = env(MY_VAR)
in auth section.
To Reproduce Steps to reproduce the behavior:
- Add following Google OAuth config in
config.toml
file
[auth.external.google]
enabled = env(GOOGLE_OAUTH_ENABLED)
client_id = "env(GOOGLE_CLIENT_ID)"
secret = "env(GOOGLE_SECRET)"
- Add
.env
file in the project root with envs
GOOGLE_OAUTH_ENABLED=false
- Try to start supabase via
supabase start
command - See error
cannot read config in /[redacted]: toml: line 64 (last key "auth.external.google.enabled"): expected value but found "env" instead
Expected behavior I can start the project with auth enabled or disabled based on the env value.
Desktop (please complete the following information):
- OS: macOS
- Version of CLI v1.77.9
- Version of Node.js (if applicable) v18.14.0
@sweatybridge any progress on this issue? Error evaluating "env(SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID)": environment variable SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID is unset.
@G9000 that looks like a config error. env(SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID)
is present in your config.toml but the env var is undefined. Did you forget to define the env var?
@G9000 that looks like a config error.
env(SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID)
is present in your config.toml but the env var is undefined. Did you forget to define the env var?
I did, it seems not detecting at all. I saw this thread but not working for me.
secret = "SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET"
That's just a static value and not using substitution.
You want to keep secret = "env(SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET)"
in config.toml and try the following
SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET=abc supabase start
Or
echo "SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET=abc" > .env
supabase start
Or
export SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET=abc
supabase start
They all should load the env var correctly into your config.toml at runtime.