Skip to content

Commit

Permalink
feat: add auht session timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
hf committed Nov 2, 2023
1 parent 9d801ee commit b3aab93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,14 @@ EOF
fmt.Sprintf("GOTRUE_SECURITY_REFRESH_TOKEN_REUSE_INTERVAL=%v", utils.Config.Auth.RefreshTokenReuseInterval),
}

if utils.Config.Auth.Sessions.Timebox > 0 {
env = append(env, fmt.Sprintf("GOTRUE_SESSIONS_TIMEBOX=%vh", utils.Config.Auth.Sessions.Timebox))
}

if utils.Config.Auth.Sessions.InactivityTimeout > 0 {
env = append(env, fmt.Sprintf("GOTRUE_SESSIONS_INACTIVITY_TIMEOUT=%vh", utils.Config.Auth.Sessions.InactivityTimeout))
}

for id, tmpl := range utils.Config.Auth.Email.Template {
if len(tmpl.ContentPath) > 0 {
env = append(env, fmt.Sprintf("GOTRUE_MAILER_TEMPLATES_%s=http://%s:%d/email/%s",
Expand Down
7 changes: 7 additions & 0 deletions internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ type (
JwtSecret string `toml:"-" mapstructure:"jwt_secret"`
AnonKey string `toml:"-" mapstructure:"anon_key"`
ServiceRoleKey string `toml:"-" mapstructure:"service_role_key"`

Sessions sessions `toml:"sessions"`
}

email struct {
Expand Down Expand Up @@ -343,6 +345,11 @@ type (
ApiKey string `toml:"-" mapstructure:"api_key"`
}

sessions struct {
Timebox float64 `toml:"timebox"`
InactivityTimeout float64 `toml:"inactivity_timeout"`
}

// TODO
// scripts struct {
// BeforeMigrations string `toml:"before_migrations"`
Expand Down

0 comments on commit b3aab93

Please sign in to comment.