add token config
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user