From 7a8cb47acb277d02f74b3107b31287e484d37712 Mon Sep 17 00:00:00 2001 From: QLeelulu Date: Fri, 7 Sep 2018 11:30:01 +0800 Subject: [PATCH] =?UTF-8?q?some=20optimize=EF=BC=9A=201.=20not=20log=20sta?= =?UTF-8?q?cktrace;=202.=20Remove=20space=20when=20read=20UUID=20from=20fi?= =?UTF-8?q?le;=203.=20Config=20sample=20file=20optimize;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/node/server.go | 1 + conf/conf.go | 3 ++- conf/files/base.json.sample | 2 +- conf/files/db.json.sample | 2 ++ conf/files/web.json.sample | 3 ++- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/node/server.go b/bin/node/server.go index b1a8693..67d2c5a 100644 --- a/bin/node/server.go +++ b/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()) diff --git a/conf/conf.go b/conf/conf.go index 107b07a..43e7652 100644 --- a/conf/conf.go +++ b/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) { diff --git a/conf/files/base.json.sample b/conf/files/base.json.sample index c7b74d3..e452970 100644 --- a/conf/files/base.json.sample +++ b/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" } diff --git a/conf/files/db.json.sample b/conf/files/db.json.sample index 327d72c..f7d63bb 100644 --- a/conf/files/db.json.sample +++ b/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 } diff --git a/conf/files/web.json.sample b/conf/files/web.json.sample index 9a97e63..d378ab4 100644 --- a/conf/files/web.json.sample +++ b/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",