add jwt config
This commit is contained in:
@@ -32,14 +32,21 @@ type FuncConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
|
SignAlg string `mapstructure:"sign_alg"`
|
||||||
|
HMACSecretPath string `mapstructure:"hmac_secret_path"`
|
||||||
RefreshTokenTTL time.Duration `mapstructure:"refresh_token_ttl"`
|
RefreshTokenTTL time.Duration `mapstructure:"refresh_token_ttl"`
|
||||||
AccessTokenTTL time.Duration `mapstructure:"access_token_ttl"`
|
AccessTokenTTL time.Duration `mapstructure:"access_token_ttl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
DataPath string `mapstructure:"data_dir"`
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Server ServerConfig `mapstructure:"server"`
|
Server ServerConfig `mapstructure:"server"`
|
||||||
Functions FuncConfig `mapstructure:"functions"`
|
Functions FuncConfig `mapstructure:"functions"`
|
||||||
Auth Auth `mapstructure:"auth"`
|
Auth Auth `mapstructure:"auth"`
|
||||||
|
Data Data `mapstructure:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var configPath atomic.Value // string
|
var configPath atomic.Value // string
|
||||||
@@ -54,10 +61,14 @@ var defaults = map[string]any{
|
|||||||
"server.block.enabled": true,
|
"server.block.enabled": true,
|
||||||
"server.block.block_dir": "./blocks",
|
"server.block.block_dir": "./blocks",
|
||||||
|
|
||||||
|
"data.data_dir": "./data",
|
||||||
|
|
||||||
"functions.func_dir": "./functions",
|
"functions.func_dir": "./functions",
|
||||||
|
|
||||||
"auth.refresh_token_ttl": 24 * time.Hour,
|
"auth.refresh_token_ttl": 24 * time.Hour,
|
||||||
"auth.access_token_ttl": 15 * time.Minute,
|
"auth.access_token_ttl": 15 * time.Minute,
|
||||||
|
"auth.sign_alg": "HS256",
|
||||||
|
"auth.hmac_secret_path": "./secret/hmac_secret",
|
||||||
}
|
}
|
||||||
|
|
||||||
func read(cfg *Config) error {
|
func read(cfg *Config) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user