Rename server-* to http-*, see #50

This commit is contained in:
Michael Mayer 2018-12-21 03:11:06 +01:00
parent cde4eb5d92
commit 49793a3706
2 changed files with 16 additions and 16 deletions

View file

@ -19,22 +19,22 @@ var StartCommand = cli.Command{
var startFlags = []cli.Flag{ var startFlags = []cli.Flag{
cli.IntFlag{ cli.IntFlag{
Name: "server-port, p", Name: "http-port, p",
Usage: "HTTP server port", Usage: "HTTP server port",
Value: 80, Value: 80,
EnvVar: "PHOTOPRISM_SERVER_PORT", EnvVar: "PHOTOPRISM_HTTP_PORT",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "server-host, i", Name: "http-host, i",
Usage: "HTTP server host", Usage: "HTTP server host",
Value: "", Value: "",
EnvVar: "PHOTOPRISM_SERVER_HOST", EnvVar: "PHOTOPRISM_HTTP_HOST",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "server-mode, m", Name: "http-mode, m",
Usage: "debug, release or test", Usage: "debug, release or test",
Value: "", Value: "",
EnvVar: "PHOTOPRISM_SERVER_MODE", EnvVar: "PHOTOPRISM_HTTP_MODE",
}, },
} }
@ -51,7 +51,7 @@ func startAction(ctx *cli.Context) error {
conf.MigrateDb() conf.MigrateDb()
fmt.Printf("Starting web server at %s:%d...\n", ctx.String("server-host"), ctx.Int("server-port")) fmt.Printf("Starting web server at %s:%d...\n", ctx.String("http-host"), ctx.Int("http-port"))
server.Start(conf) server.Start(conf)

View file

@ -94,15 +94,15 @@ func (c *Config) SetValuesFromFile(fileName string) error {
c.dbServerPath = dbServerPath c.dbServerPath = dbServerPath
} }
if httpServerHost, err := yamlConfig.Get("server-host"); err == nil { if httpServerHost, err := yamlConfig.Get("http-host"); err == nil {
c.httpServerHost = httpServerHost c.httpServerHost = httpServerHost
} }
if httpServerPort, err := yamlConfig.GetInt("server-port"); err == nil { if httpServerPort, err := yamlConfig.GetInt("http-port"); err == nil {
c.httpServerPort = int(httpServerPort) c.httpServerPort = int(httpServerPort)
} }
if serverMode, err := yamlConfig.Get("server-mode"); err == nil { if serverMode, err := yamlConfig.Get("http-mode"); err == nil {
c.serverMode = serverMode c.serverMode = serverMode
} }
@ -192,16 +192,16 @@ func (c *Config) SetValuesFromCliContext(ctx *cli.Context) error {
c.dbServerPath = ctx.String("db-path") c.dbServerPath = ctx.String("db-path")
} }
if ctx.IsSet("server-host") || c.httpServerHost == "" { if ctx.IsSet("http-host") || c.httpServerHost == "" {
c.httpServerHost = ctx.String("server-host") c.httpServerHost = ctx.String("http-host")
} }
if ctx.IsSet("server-port") || c.httpServerPort == 0 { if ctx.IsSet("http-port") || c.httpServerPort == 0 {
c.httpServerPort = ctx.Int("server-port") c.httpServerPort = ctx.Int("http-port")
} }
if ctx.IsSet("server-mode") || c.serverMode == "" { if ctx.IsSet("http-mode") || c.serverMode == "" {
c.serverMode = ctx.String("server-mode") c.serverMode = ctx.String("http-mode")
} }
return nil return nil