增加默认配置

This commit is contained in:
lwch
2022-10-18 10:26:27 +08:00
parent 866414db65
commit 6aedf0f68b
2 changed files with 21 additions and 0 deletions
+14
View File
@@ -73,6 +73,20 @@ func LoadConf(dir string) *Configure {
Rules []Rule `yaml:"rules"`
CodeDir string `yaml:"codedir"`
}
cfg.ID = "unset"
cfg.Server = "127.0.0.1:6154"
cfg.SSL.Enabled = false
cfg.SSL.Insecure = false
cfg.Dashboard.Enabled = true
cfg.Dashboard.Listen = "0.0.0.0"
cfg.Dashboard.Port = 8080
cfg.Secret = "0123456789"
cfg.Link.ReadTimeout = time.Second
cfg.Link.WriteTimeout = time.Second
cfg.Log.Dir = "./logs"
cfg.Log.Size = 50 * 1024 * 1024
cfg.Log.Rotate = 7
cfg.CodeDir = "./code"
runtime.Assert(yaml.Decode(dir, &cfg))
for i, t := range cfg.Rules {
switch t.Type {
+7
View File
@@ -43,6 +43,13 @@ func LoadConf(dir string) *Configure {
Crt string `yaml:"crt"`
} `yaml:"tls"`
}
cfg.Listen = 6154
cfg.Secret = "0123456789"
cfg.Link.ReadTimeout = time.Second
cfg.Link.WriteTimeout = time.Second
cfg.Log.Dir = "./logs"
cfg.Log.Size = 50 * 1024 * 1024
cfg.Log.Rotate = 7
runtime.Assert(yaml.Decode(dir, &cfg))
if !filepath.IsAbs(cfg.Log.Dir) {
dir, err := os.Executable()