Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod deploy #2185

Merged
merged 6 commits into from
Apr 18, 2024
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
9 changes: 7 additions & 2 deletions internal/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ EOF
"GOTRUE_SMTP_HOST=" + utils.InbucketId,
"GOTRUE_SMTP_PORT=2500",
"[email protected]",
"GOTRUE_SMTP_MAX_FREQUENCY=1s",
fmt.Sprintf("GOTRUE_SMTP_MAX_FREQUENCY=%v", utils.Config.Auth.Email.MaxFrequency),
// TODO: To be reverted to `/auth/v1/verify` once
// https://github.com/supabase/supabase/issues/16100
// is fixed on upstream GoTrue.
Expand All @@ -421,7 +421,7 @@ EOF

fmt.Sprintf("GOTRUE_EXTERNAL_PHONE_ENABLED=%v", utils.Config.Auth.Sms.EnableSignup),
fmt.Sprintf("GOTRUE_SMS_AUTOCONFIRM=%v", !utils.Config.Auth.Sms.EnableConfirmations),
"GOTRUE_SMS_MAX_FREQUENCY=5s",
fmt.Sprintf("GOTRUE_SMS_MAX_FREQUENCY=%v", utils.Config.Auth.Sms.MaxFrequency),
"GOTRUE_SMS_OTP_EXP=6000",
"GOTRUE_SMS_OTP_LENGTH=6",
fmt.Sprintf("GOTRUE_SMS_TEMPLATE=%v", utils.Config.Auth.Sms.Template),
Expand Down Expand Up @@ -635,6 +635,11 @@ EOF
"RLIMIT_NOFILE=",
fmt.Sprintf("MAX_HEADER_LENGTH=%d", utils.Config.Realtime.MaxHeaderLength),
},
// TODO: remove this after deprecating PG14
Cmd: []string{
"/bin/sh", "-c",
"/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server",
},
ExposedPorts: nat.PortSet{"4000/tcp": {}},
Healthcheck: &container.HealthConfig{
Test: []string{"CMD", "curl", "-sSfL", "--head", "-o", "/dev/null", "-H", "Authorization: Bearer " + utils.Config.Auth.AnonKey,
Expand Down
8 changes: 3 additions & 5 deletions internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ var Config = config{
"email_change": {},
},
},
Sms: sms{
Template: "Your code is {{ .Code }} .",
},
External: map[string]provider{
"apple": {},
"azure": {},
Expand All @@ -219,8 +216,6 @@ var Config = config{
"workos": {},
"zoom": {},
},
Hook: hook{},
JwtExpiry: 3600,
JwtSecret: defaultJwtSecret,
},
Analytics: analytics{
Expand Down Expand Up @@ -367,6 +362,7 @@ type (
DoubleConfirmChanges bool `toml:"double_confirm_changes"`
EnableConfirmations bool `toml:"enable_confirmations"`
Template map[string]emailTemplate `toml:"template"`
MaxFrequency time.Duration `toml:"max_frequency"`
}

emailTemplate struct {
Expand All @@ -384,6 +380,7 @@ type (
Textlocal textlocalConfig `toml:"textlocal" mapstructure:"textlocal"`
Vonage vonageConfig `toml:"vonage" mapstructure:"vonage"`
TestOTP map[string]string `toml:"test_otp"`
MaxFrequency time.Duration `toml:"max_frequency"`
}

hook struct {
Expand Down Expand Up @@ -604,6 +601,7 @@ func LoadConfigFS(fsys afero.Fs) error {
return errors.New("Missing required field in config: inbucket.port")
}
}

// Validate auth config
if Config.Auth.Enabled {
if Config.Auth.SiteUrl == "" {
Expand Down
4 changes: 4 additions & 0 deletions internal/utils/templates/init_config.test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ enable_signup = true
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
max_frequency = "1s"

# Uncomment to customize email template
[auth.email.template.invite]
Expand All @@ -110,6 +112,8 @@ enable_signup = true
enable_confirmations = false
# Template for sending OTP to users
template = "Your code is {{ `{{ .Code }}` }} ."
# Controls the minimum amount of time that must pass before sending another sms otp.
max_frequency = "5s"

# Use pre-defined map of phone number to OTP for testing.
[auth.sms.test_otp]
Expand Down
4 changes: 4 additions & 0 deletions internal/utils/templates/init_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ enable_signup = true
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
max_frequency = "1s"

# Uncomment to customize email template
# [auth.email.template.invite]
Expand All @@ -112,6 +114,8 @@ enable_signup = true
enable_confirmations = false
# Template for sending OTP to users
template = "Your code is {{ `{{ .Code }}` }} ."
# Controls the minimum amount of time that must pass before sending another sms otp.
max_frequency = "5s"

# Use pre-defined map of phone number to OTP for testing.
# [auth.sms.test_otp]
Expand Down