some tests and major cleanup

This commit is contained in:
ston1th 2018-10-19 23:08:32 +02:00
commit 16671b3406
30 changed files with 192057 additions and 202431 deletions

View file

@ -32,6 +32,9 @@ var (
)
func initServer(conf core.Config) (err error) {
if err = core.Pledge("stdio rpath wpath cpath inet fattr flock proc exec id", ""); err != nil {
return
}
dropCfg := godrop.Config{
User: conf.User,
Group: conf.Group,
@ -47,7 +50,11 @@ func initServer(conf core.Config) (err error) {
return
}
log.NewLogger(conf.LogFile)
if err = core.Pledge("stdio rpath wpath cpath inet fattr flock", ""); err != nil {
return
}
log.InitLogger(conf.DataDir, conf.LogFile, conf.Debug)
l, err := godrop.GetListener()
if err != nil {
@ -89,7 +96,7 @@ func Run(version string) {
Action: func(c *cli.Context) error {
conf.Version = app.Version
if err := initServer(conf); err != nil {
stdlog.Fatal("server: ", err)
stdlog.Fatal(err)
}
return nil
},
@ -187,7 +194,7 @@ func serverFlags() []cli.Flag {
cli.StringFlag{
Name: "log",
Value: defLogFile,
Usage: "log file (leave empty for stdout, this only works in combination with -f)",
Usage: "log file (use - for stdout, this only works in combination with -f)",
Destination: &conf.LogFile,
},
cli.StringFlag{
@ -208,7 +215,7 @@ func serverFlags() []cli.Flag {
cli.BoolFlag{
Name: "debug",
Usage: "enable debugging",
Destination: &log.DebugEnabled,
Destination: &conf.Debug,
},
}
}