Skip to content

Commit 6aedf0f

Browse files
committed
增加默认配置
1 parent 866414d commit 6aedf0f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

code/client/global/conf.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ func LoadConf(dir string) *Configure {
7373
Rules []Rule `yaml:"rules"`
7474
CodeDir string `yaml:"codedir"`
7575
}
76+
cfg.ID = "unset"
77+
cfg.Server = "127.0.0.1:6154"
78+
cfg.SSL.Enabled = false
79+
cfg.SSL.Insecure = false
80+
cfg.Dashboard.Enabled = true
81+
cfg.Dashboard.Listen = "0.0.0.0"
82+
cfg.Dashboard.Port = 8080
83+
cfg.Secret = "0123456789"
84+
cfg.Link.ReadTimeout = time.Second
85+
cfg.Link.WriteTimeout = time.Second
86+
cfg.Log.Dir = "./logs"
87+
cfg.Log.Size = 50 * 1024 * 1024
88+
cfg.Log.Rotate = 7
89+
cfg.CodeDir = "./code"
7690
runtime.Assert(yaml.Decode(dir, &cfg))
7791
for i, t := range cfg.Rules {
7892
switch t.Type {

code/server/global/conf.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ func LoadConf(dir string) *Configure {
4343
Crt string `yaml:"crt"`
4444
} `yaml:"tls"`
4545
}
46+
cfg.Listen = 6154
47+
cfg.Secret = "0123456789"
48+
cfg.Link.ReadTimeout = time.Second
49+
cfg.Link.WriteTimeout = time.Second
50+
cfg.Log.Dir = "./logs"
51+
cfg.Log.Size = 50 * 1024 * 1024
52+
cfg.Log.Rotate = 7
4653
runtime.Assert(yaml.Decode(dir, &cfg))
4754
if !filepath.IsAbs(cfg.Log.Dir) {
4855
dir, err := os.Executable()

0 commit comments

Comments
 (0)