supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 201 forks source link

env replacement in [auth.sms.twilio] / `account_sid` #2647

Open mfazekas opened 2 weeks ago

mfazekas commented 2 weeks ago

Describe the bug It seems that env(...) is not evaluated in account_sid. Twilio works if it put value directly in account_sid but it doesn't if i try to use and env. env(...) works in auth_token

To Reproduce

Edit your config.toml

[auth.sms.twilio]
enabled = true
account_sid = "env(FOO12)"
message_service_sid = "env(FOO23)"
auth_token = "env(FOO34)"

Start supabase with the referenced variables set:

FOO12=foo12 FOO23=foo23 FOO34=foo34 npx supabase@1.191.3 start

Inspect variables in docker:

% docker inspect supabase_auth_db |  grep TWILIO
                "GOTRUE_SMS_TWILIO_ACCOUNT_SID=env(FOO12)",
                "GOTRUE_SMS_TWILIO_AUTH_TOKEN=foo34",
                "GOTRUE_SMS_TWILIO_MESSAGE_SERVICE_SID=env(FOO23)",

Expected behavior

% docker inspect supabase_auth_db |  grep TWILIO
                "GOTRUE_SMS_TWILIO_ACCOUNT_SID=foo12",
                "GOTRUE_SMS_TWILIO_AUTH_TOKEN=foo34",
                "GOTRUE_SMS_TWILIO_MESSAGE_SERVICE_SID=foo23",

Screenshots If applicable, add screenshots to help explain your problem.

System information Rerun the failing command with --create-ticket flag.

mfazekas commented 2 weeks ago

~Reported at auth repo instead - see https://github.com/supabase/auth/issues/1753~

Nevermind seems to be code in cli that's not doing the env replacement, but only in AuthToken:

https://github.com/supabase/cli/blob/89bc7647ae2ac125346e9bdd4645bb6289797406/pkg/config/config.go#L785-L798

fleeser commented 2 days ago

The replacement does not work for auth.hook.send_email.secrets, too.