add token config

This commit is contained in:
2025-12-18 11:25:07 +02:00
parent 97253ee9c7
commit adf61a4d1d

View File

@@ -31,9 +31,15 @@ type FuncConfig struct {
FunctionDir string `mapstructure:"func_dir"`
}
type Auth struct {
RefreshTokenTTL time.Duration `mapstructure:"refresh_token_ttl"`
AccessTokenTTL time.Duration `mapstructure:"access_token_ttl"`
}
type Config struct {
Server ServerConfig `mapstructure:"server"`
Functions FuncConfig `mapstructure:"functions"`
Auth Auth `mapstructure:"auth"`
}
var configPath atomic.Value // string
@@ -49,6 +55,9 @@ var defaults = map[string]any{
"server.block.block_dir": "./blocks",
"functions.func_dir": "./functions",
"auth.refresh_token_ttl": 24 * time.Hour,
"auth.access_token_ttl": 15 * time.Minute,
}
func read(cfg *Config) error {