feat(qs2) add qs2 framework
This commit is contained in:
parent
6ae65fe09b
commit
83100007e3
33 changed files with 2934 additions and 60 deletions
49
src/server/config.go
Normal file
49
src/server/config.go
Normal file
|
@ -0,0 +1,49 @@
|
|||
package server
|
||||
|
||||
type FSConfig struct {
|
||||
Root string `json:"root"`
|
||||
OpensLimit int `json:"opensLimit"`
|
||||
OpenTTL int `json:"openTTL"`
|
||||
}
|
||||
|
||||
type Secrets struct {
|
||||
TokenSecret string `json:"tokenSecret" cfg:"env"`
|
||||
}
|
||||
|
||||
type ServerCfg struct {
|
||||
ProdMode bool `json:"prodMode"`
|
||||
Addr string `json:"addr"`
|
||||
ReadTimeout int `json:"readTimeout"`
|
||||
WriteTimeout int `json:"writeTimeout"`
|
||||
MaxHeaderBytes int `json:"maxHeaderBytes"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Fs *FSConfig `json:"fs"`
|
||||
Secrets *Secrets `json:"secrets"`
|
||||
Server *ServerCfg `json:"server"`
|
||||
}
|
||||
|
||||
func NewEmptyConfig() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func NewDefaultConfig() *Config {
|
||||
return &Config{
|
||||
Fs: &FSConfig{
|
||||
Root: ".",
|
||||
OpensLimit: 128,
|
||||
OpenTTL: 60, // 1 min
|
||||
},
|
||||
Secrets: &Secrets{
|
||||
TokenSecret: "",
|
||||
},
|
||||
Server: &ServerCfg{
|
||||
ProdMode: true,
|
||||
Addr: "127.0.0.1:8888",
|
||||
ReadTimeout: 2000,
|
||||
WriteTimeout: 2000,
|
||||
MaxHeaderBytes: 512,
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue