fix(singleuser): fix bugs in single user handlers
This commit is contained in:
parent
31a1a331f7
commit
4d6e7ff938
10 changed files with 194 additions and 45 deletions
|
@ -6,13 +6,21 @@ type FSConfig struct {
|
|||
OpenTTL int `json:"openTTL"`
|
||||
}
|
||||
|
||||
type UsersCfg struct {
|
||||
EnableAuth bool `json:"enableAuth"`
|
||||
CookieTTL int `json:"cookieTTL"`
|
||||
CookieSecure bool `json:"cookieSecure"`
|
||||
CookieHttpOnly bool `json:"cookieHttpOnly"`
|
||||
}
|
||||
|
||||
type Secrets struct {
|
||||
TokenSecret string `json:"tokenSecret" cfg:"env"`
|
||||
}
|
||||
|
||||
type ServerCfg struct {
|
||||
Debug bool `json:"debug"`
|
||||
Addr string `json:"addr"`
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
ReadTimeout int `json:"readTimeout"`
|
||||
WriteTimeout int `json:"writeTimeout"`
|
||||
MaxHeaderBytes int `json:"maxHeaderBytes"`
|
||||
|
@ -22,6 +30,7 @@ type Config struct {
|
|||
Fs *FSConfig `json:"fs"`
|
||||
Secrets *Secrets `json:"secrets"`
|
||||
Server *ServerCfg `json:"server"`
|
||||
Users *UsersCfg `json:"users"`
|
||||
}
|
||||
|
||||
func NewEmptyConfig() *Config {
|
||||
|
@ -35,12 +44,19 @@ func NewDefaultConfig() *Config {
|
|||
OpensLimit: 128,
|
||||
OpenTTL: 60, // 1 min
|
||||
},
|
||||
Users: &UsersCfg{
|
||||
EnableAuth: true,
|
||||
CookieTTL: 3600 * 24 * 7, // 1 week
|
||||
CookieSecure: false,
|
||||
CookieHttpOnly: true,
|
||||
},
|
||||
Secrets: &Secrets{
|
||||
TokenSecret: "",
|
||||
},
|
||||
Server: &ServerCfg{
|
||||
Debug: false,
|
||||
Addr: "127.0.0.1:8888",
|
||||
Host: "127.0.0.1",
|
||||
Port: 8888,
|
||||
ReadTimeout: 2000,
|
||||
WriteTimeout: 2000,
|
||||
MaxHeaderBytes: 512,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue