diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-29 08:42:33 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-29 08:42:33 -0700 |
| commit | 0c0b2680077c1103609c87a652bcc2263460b1d7 (patch) | |
| tree | 9968655a20d3caec9077b49db2473cbdb344cb71 /server | |
| parent | 95753255a17026750f5b53cc470999785e0c515f (diff) | |
Re-organize cmd paths
Diffstat (limited to 'server')
| -rw-r--r-- | server/main.go | 73 | ||||
| -rw-r--r-- | server/mobius/config/Agreement.txt | 1 | ||||
| -rw-r--r-- | server/mobius/config/Files/hello.txt | 1 | ||||
| -rw-r--r-- | server/mobius/config/MessageBoard.txt | 1 | ||||
| -rw-r--r-- | server/mobius/config/ThreadedNews.yaml | 1 | ||||
| -rw-r--r-- | server/mobius/config/Users/admin.yaml | 12 | ||||
| -rw-r--r-- | server/mobius/config/Users/guest.yaml | 12 | ||||
| -rw-r--r-- | server/mobius/config/config.yaml | 12 |
8 files changed, 0 insertions, 113 deletions
diff --git a/server/main.go b/server/main.go deleted file mode 100644 index 772625b..0000000 --- a/server/main.go +++ /dev/null @@ -1,73 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "github.com/jhalter/mobius/hotline" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "os" -) - -const ( - defaultConfigPath = "/usr/local/var/mobius/config/" // matches Homebrew default config location - defaultPort = 5500 -) - -func main() { - ctx, cancelRoot := context.WithCancel(context.Background()) - - basePort := flag.Int("bind", defaultPort, "Bind address and port") - configDir := flag.String("config", defaultConfigPath, "Path to config root") - version := flag.Bool("version", false, "print version and exit") - logLevel := flag.String("log-level", "info", "Log level") - flag.Parse() - - if *version { - fmt.Printf("v%s\n", hotline.VERSION) - os.Exit(0) - } - - zapLvl, ok := zapLogLevel[*logLevel] - if !ok { - fmt.Printf("Invalid log level %s. Must be debug, info, warn, or error.\n", *logLevel) - os.Exit(0) - } - - cores := []zapcore.Core{newStdoutCore(zapLvl)} - l := zap.New(zapcore.NewTee(cores...)) - defer func() { _ = l.Sync() }() - logger := l.Sugar() - - if _, err := os.Stat(*configDir); os.IsNotExist(err) { - logger.Fatalw("Configuration directory not found", "path", configDir) - } - - srv, err := hotline.NewServer(*configDir, "", *basePort, logger) - if err != nil { - logger.Fatal(err) - } - - // Serve Hotline requests until program exit - logger.Fatal(srv.ListenAndServe(ctx, cancelRoot)) -} - -func newStdoutCore(level zapcore.Level) zapcore.Core { - encoderCfg := zap.NewProductionEncoderConfig() - encoderCfg.TimeKey = "timestamp" - encoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder - - return zapcore.NewCore( - zapcore.NewConsoleEncoder(encoderCfg), - zapcore.Lock(os.Stdout), - level, - ) -} - -var zapLogLevel = map[string]zapcore.Level{ - "debug": zap.DebugLevel, - "info": zap.InfoLevel, - "warn": zap.WarnLevel, - "error": zap.ErrorLevel, -} diff --git a/server/mobius/config/Agreement.txt b/server/mobius/config/Agreement.txt deleted file mode 100644 index 5da4639..0000000 --- a/server/mobius/config/Agreement.txt +++ /dev/null @@ -1 +0,0 @@ -This is an agreement. Say you agree. diff --git a/server/mobius/config/Files/hello.txt b/server/mobius/config/Files/hello.txt deleted file mode 100644 index 271a837..0000000 --- a/server/mobius/config/Files/hello.txt +++ /dev/null @@ -1 +0,0 @@ -I'm a test file
\ No newline at end of file diff --git a/server/mobius/config/MessageBoard.txt b/server/mobius/config/MessageBoard.txt deleted file mode 100644 index cb36354..0000000 --- a/server/mobius/config/MessageBoard.txt +++ /dev/null @@ -1 +0,0 @@ -Welcome to Hotline diff --git a/server/mobius/config/ThreadedNews.yaml b/server/mobius/config/ThreadedNews.yaml deleted file mode 100644 index 59e0a68..0000000 --- a/server/mobius/config/ThreadedNews.yaml +++ /dev/null @@ -1 +0,0 @@ -Categories: {} diff --git a/server/mobius/config/Users/admin.yaml b/server/mobius/config/Users/admin.yaml deleted file mode 100644 index 5413735..0000000 --- a/server/mobius/config/Users/admin.yaml +++ /dev/null @@ -1,12 +0,0 @@ -Login: admin -Name: admin -Password: $2a$04$2itGEYx8C1N5bsfRSoC9JuonS3I4YfnyVPZHLSwp7kEInRX0yoB.a -Access: -- 255 -- 255 -- 255 -- 255 -- 255 -- 255 -- 255 -- 255 diff --git a/server/mobius/config/Users/guest.yaml b/server/mobius/config/Users/guest.yaml deleted file mode 100644 index a1e4069..0000000 --- a/server/mobius/config/Users/guest.yaml +++ /dev/null @@ -1,12 +0,0 @@ -Login: guest -Name: guest -Password: $2a$04$9P/jgLn1fR9TjSoWL.rKxuN6g.1TSpf2o6Hw.aaRuBwrWIJNwsKkS -Access: -- 252 -- 240 -- 205 -- 201 -- 43 -- 128 -- 0 -- 0 diff --git a/server/mobius/config/config.yaml b/server/mobius/config/config.yaml deleted file mode 100644 index 5c8b202..0000000 --- a/server/mobius/config/config.yaml +++ /dev/null @@ -1,12 +0,0 @@ -Name: My Hotline server -Description: A default configured Hotline server running Mobius v0.0.1 -BannerID: 0 -FileRoot: Files/ -EnableTrackerRegistration: false -Trackers: -- hltracker.com:5499 -NewsDelimiter: "" -NewsDateFormat: "" -MaxDownloads: 0 -MaxDownloadsPerClient: 0 -MaxConnectionsPerIP: 0 |