update options desc and log

This commit is contained in:
nikk gitanes
2021-08-15 08:47:21 +03:00
parent 18fec4e2bf
commit b7682545e1
2 changed files with 11 additions and 11 deletions

View File

@@ -22,14 +22,14 @@ import (
type args struct { type args struct {
Port string `arg:"-p" help:"web server port"` Port string `arg:"-p" help:"web server port"`
Path string `arg:"-d" help:"database path"` Path string `arg:"-d" help:"database dir path"`
LogPath string `arg:"-l" help:"log path"` LogPath string `arg:"-l" help:"server log file path"`
WebLogPath string `arg:"-w" help:"web log path"` WebLogPath string `arg:"-w" help:"web access log file path"`
RDB bool `arg:"-r" help:"start in read-only DB mode"` RDB bool `arg:"-r" help:"start in read-only DB mode"`
HttpAuth bool `arg:"-a" help:"http auth on all requests"` HttpAuth bool `arg:"-a" help:"enable http auth on all requests"`
DontKill bool `arg:"-k" help:"dont kill server on signal"` DontKill bool `arg:"-k" help:"don't kill server on signal"`
UI bool `arg:"-u" help:"run page torrserver in browser"` UI bool `arg:"-u" help:"open torrserver page in browser"`
TorrentsDir string `arg:"-t" help:"autoload torrent from dir"` TorrentsDir string `arg:"-t" help:"autoload torrents from dir"`
} }
func (args) Version() string { func (args) Version() string {

View File

@@ -3,10 +3,11 @@
package main package main
import ( import (
"fmt"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"server/log"
) )
func Preconfig(dkill bool) { func Preconfig(dkill bool) {
@@ -15,15 +16,14 @@ func Preconfig(dkill bool) {
signal.Notify(sigc, signal.Notify(sigc,
syscall.SIGHUP, syscall.SIGHUP,
syscall.SIGINT, syscall.SIGINT,
syscall.SIGPIPE, syscall.SIGPIPE,
syscall.SIGTERM, syscall.SIGTERM,
syscall.SIGQUIT) syscall.SIGQUIT)
go func() { go func() {
for s := range sigc { for s := range sigc {
if dkill { if dkill {
fmt.Println("Signal catched:", s) log.TLogln("Signal catched:", s)
fmt.Println("For stop server, close in api") log.TLogln("To stop server, close it from web / api")
} }
} }
}() }()