Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ EOF
"SUPABASE_ANON_KEY=" + utils.Config.Auth.AnonKey,
"SUPABASE_SERVICE_KEY=" + utils.Config.Auth.ServiceRoleKey,
"LOGFLARE_API_KEY=" + utils.Config.Analytics.ApiKey,
"OPENAI_KEY=" + utils.Config.Studio.OpenaiApiKey,
fmt.Sprintf("LOGFLARE_URL=http://%v:4000", utils.LogflareId),
fmt.Sprintf("NEXT_PUBLIC_ENABLE_LOGS=%v", utils.Config.Analytics.Enabled),
fmt.Sprintf("NEXT_ANALYTICS_BACKEND_PROVIDER=%v", utils.Config.Analytics.Backend),
Expand Down
10 changes: 6 additions & 4 deletions internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ var Config = config{
}

// We follow these rules when adding new config:
// 1. Update init_config.toml with the new key, default value, and comments to explain usage.
// 1. Update init_config.toml (and init_config.test.toml) with the new key, default value, and comments to explain usage.
// 2. Update config struct with new field and toml tag (spelled in snake_case).
// 3. Add custom field validations to LoadConfigFS function for eg. integer range checks.
//
Expand Down Expand Up @@ -286,9 +286,10 @@ type (
}

studio struct {
Enabled bool `toml:"enabled"`
Port uint `toml:"port"`
ApiUrl string `toml:"api_url"`
Enabled bool `toml:"enabled"`
Port uint `toml:"port"`
ApiUrl string `toml:"api_url"`
OpenaiApiKey string `toml:"openai_api_key"`
}

inbucket struct {
Expand Down Expand Up @@ -560,6 +561,7 @@ func LoadConfigFS(fsys afero.Fs) error {
if Config.Studio.Port == 0 {
return errors.New("Missing required field in config: studio.port")
}
Config.Studio.OpenaiApiKey, _ = maybeLoadEnv(Config.Studio.OpenaiApiKey)
}
// Validate email config
if Config.Inbucket.Enabled {
Expand Down
2 changes: 2 additions & 0 deletions internal/utils/templates/init_config.test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enabled = true
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://127.0.0.1"
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"

# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
Expand Down
2 changes: 2 additions & 0 deletions internal/utils/templates/init_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enabled = true
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://127.0.0.1"
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"

# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
Expand Down