You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package govue
import ( "errors" "git.ouxuan.net/3136352472/go-service-template/pool" )
type Config struct { Addr string `json:"addr"` StaticDir string `json:"static_dir"` UseJsFile string `json:"use_js_file"` ErrorPage404 string `json:"error_page_404"` Mode string `json:"mode"` Pool pool.Config `json:"pool"` }
func GenerateConfig(path string) (err error) { if pathExists(path) { err = errors.New("配置文件已存在") return }
config := Config{ Addr: "0.0.0.0:8080", StaticDir: "static", UseJsFile: "static/use.js", Mode: "release", Pool: pool.Config{ MaxIdle: 2000, MinIdle: 5, MaxTotal: 6000, }, } jsonToFile(path, config) return }
func GetConfig(path string) (c *Config, err error) { c = &Config{ Addr: "0.0.0.0:8080", StaticDir: "static", UseJsFile: "static/use.js", Mode: "release", Pool: pool.Config{ MaxIdle: 2000, MinIdle: 5, MaxTotal: 6000, }, }
if pathExists(path) { jsonByFile(path, c) }
return
}
|