Browse Source

some optimize:

1. not log stacktrace;
2. Remove space when read UUID from file;
3. Config sample file optimize;
pull/103/head
QLeelulu 6 years ago
parent
commit
7a8cb47acb
  1. 1
      bin/node/server.go
  2. 3
      conf/conf.go
  3. 2
      conf/files/base.json.sample
  4. 2
      conf/files/db.json.sample
  5. 3
      conf/files/web.json.sample

1
bin/node/server.go

@ -27,6 +27,7 @@ func main() {
lcf := zap.NewDevelopmentConfig()
lcf.Level.SetLevel(zapcore.Level(*level))
lcf.Development = false
lcf.DisableStacktrace = true
logger, err := lcf.Build(zap.AddCallerSkip(1))
if err != nil {
slog.Fatalln("new log err:", err.Error())

3
conf/conf.go

@ -159,7 +159,8 @@ func (c *Conf) UUID() (string, error) {
if len(b) == 0 {
return c.genUUID()
}
return string(b), nil
suid := strings.Join(strings.Fields(string(b)), "")
return suid, nil
}
if !os.IsNotExist(err) {

2
conf/files/base.json.sample

@ -24,6 +24,6 @@
"Security": "@extend:security.json",
"#comment": "PIDFile and UUIDFile just work for cronnode",
"#PIDFile": "Given a none-empty string to write a pid file to the specialed path, or leave it empty to do nothing",
"PIDFile": "/tmp/cronsun/cronnode_pid",
"PIDFile": "/var/run/cronsun/cronnode.pid",
"UUIDFile": "/etc/cronsun/CRONSUN_UUID"
}

2
conf/files/db.json.sample

@ -3,6 +3,8 @@
"127.0.0.1:27017"
],
"Database": "cronsun",
"UserName": "",
"Password": "",
"#Timeout": "connect timeout duration/second",
"Timeout": 15
}

3
conf/files/web.json.sample

@ -1,11 +1,12 @@
{
"BindAddr": ":7079",
"Auth": {
"#Enabled": "set to true to open auth. default username and password is admin@admin.com/admin",
"Enabled": false
},
"Session": {
"StorePrefixPath": "/cronsun/sess/",
"CookieName": "uid",
"CookieName": "cronsun_uid",
"Expiration": 8640000
},
"#comment": "Delete the expired log (which store in mongodb) periodically",

Loading…
Cancel
Save