mirror of https://github.com/shunfei/cronsun
some optimize:
1. not log stacktrace; 2. Remove space when read UUID from file; 3. Config sample file optimize;pull/103/head
parent
20dce7d6cf
commit
7a8cb47acb
|
@ -27,6 +27,7 @@ func main() {
|
||||||
lcf := zap.NewDevelopmentConfig()
|
lcf := zap.NewDevelopmentConfig()
|
||||||
lcf.Level.SetLevel(zapcore.Level(*level))
|
lcf.Level.SetLevel(zapcore.Level(*level))
|
||||||
lcf.Development = false
|
lcf.Development = false
|
||||||
|
lcf.DisableStacktrace = true
|
||||||
logger, err := lcf.Build(zap.AddCallerSkip(1))
|
logger, err := lcf.Build(zap.AddCallerSkip(1))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Fatalln("new log err:", err.Error())
|
slog.Fatalln("new log err:", err.Error())
|
||||||
|
|
|
@ -159,7 +159,8 @@ func (c *Conf) UUID() (string, error) {
|
||||||
if len(b) == 0 {
|
if len(b) == 0 {
|
||||||
return c.genUUID()
|
return c.genUUID()
|
||||||
}
|
}
|
||||||
return string(b), nil
|
suid := strings.Join(strings.Fields(string(b)), "")
|
||||||
|
return suid, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
"Security": "@extend:security.json",
|
"Security": "@extend:security.json",
|
||||||
"#comment": "PIDFile and UUIDFile just work for cronnode",
|
"#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": "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"
|
"UUIDFile": "/etc/cronsun/CRONSUN_UUID"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
"127.0.0.1:27017"
|
"127.0.0.1:27017"
|
||||||
],
|
],
|
||||||
"Database": "cronsun",
|
"Database": "cronsun",
|
||||||
|
"UserName": "",
|
||||||
|
"Password": "",
|
||||||
"#Timeout": "connect timeout duration/second",
|
"#Timeout": "connect timeout duration/second",
|
||||||
"Timeout": 15
|
"Timeout": 15
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"BindAddr": ":7079",
|
"BindAddr": ":7079",
|
||||||
"Auth": {
|
"Auth": {
|
||||||
|
"#Enabled": "set to true to open auth. default username and password is admin@admin.com/admin",
|
||||||
"Enabled": false
|
"Enabled": false
|
||||||
},
|
},
|
||||||
"Session": {
|
"Session": {
|
||||||
"StorePrefixPath": "/cronsun/sess/",
|
"StorePrefixPath": "/cronsun/sess/",
|
||||||
"CookieName": "uid",
|
"CookieName": "cronsun_uid",
|
||||||
"Expiration": 8640000
|
"Expiration": 8640000
|
||||||
},
|
},
|
||||||
"#comment": "Delete the expired log (which store in mongodb) periodically",
|
"#comment": "Delete the expired log (which store in mongodb) periodically",
|
||||||
|
|
Loading…
Reference in New Issue