Skip to content

Commit

Permalink
fix(config): use SUPABASE env prefix (#2778)
Browse files Browse the repository at this point in the history
* fix(config): use SUPABASE env prefix

* fix: tests
  • Loading branch information
avallete authored Oct 17, 2024
1 parent adda496 commit 5f8587b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ func (c *config) loadFromEnv() error {
return errors.Errorf("failed to decode env: %w", err)
}
v := viper.New()
v.SetEnvPrefix("SUPABASE")
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
v.AutomaticEnv()
if err := v.MergeConfigMap(envKeysMap); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ func TestLoadSeedPaths(t *testing.T) {
}

func TestLoadEnv(t *testing.T) {
t.Setenv("AUTH_JWT_SECRET", "test-secret")
t.Setenv("DB_ROOT_KEY", "test-root-key")
t.Setenv("SUPABASE_AUTH_JWT_SECRET", "test-secret")
t.Setenv("SUPABASE_DB_ROOT_KEY", "test-root-key")
config := NewConfig()
// Run test
err := config.loadFromEnv()
Expand Down

0 comments on commit 5f8587b

Please sign in to comment.