feat: add multi-source breed encyclopedia and two-hour refresh sessions
This commit is contained in:
@@ -52,8 +52,9 @@ type MinIOConfig struct {
|
||||
}
|
||||
|
||||
type JWTConfig struct {
|
||||
Secret string `mapstructure:"secret"`
|
||||
ExpireHours int `mapstructure:"expire_hours"`
|
||||
Secret string `mapstructure:"secret"`
|
||||
ExpireHours int `mapstructure:"expire_hours"`
|
||||
RefreshHours int `mapstructure:"refresh_hours"`
|
||||
}
|
||||
|
||||
type WeChatConfig struct {
|
||||
@@ -87,7 +88,8 @@ func Load() (*Config, error) {
|
||||
v.SetDefault("minio.bucket", "sundynix-pet")
|
||||
v.SetDefault("minio.use_ssl", true)
|
||||
v.SetDefault("jwt.secret", "")
|
||||
v.SetDefault("jwt.expire_hours", 168)
|
||||
v.SetDefault("jwt.expire_hours", 2)
|
||||
v.SetDefault("jwt.refresh_hours", 2)
|
||||
v.SetDefault("wechat.app_id", "")
|
||||
v.SetDefault("wechat.app_secret", "")
|
||||
v.SetDefault("auth.dev_login", false)
|
||||
@@ -120,5 +122,8 @@ func Load() (*Config, error) {
|
||||
if cfg.Server.Mode == "release" && cfg.Auth.DevLogin {
|
||||
return nil, errors.New("dev login must be disabled in release mode")
|
||||
}
|
||||
// Access tokens have the same fixed two-hour lifetime for both clients.
|
||||
cfg.JWT.ExpireHours = 2
|
||||
cfg.JWT.RefreshHours = 2
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user