diff --git a/internal/commands/start.go b/internal/commands/start.go index 0206aa2e1..b8b6d68bc 100644 --- a/internal/commands/start.go +++ b/internal/commands/start.go @@ -41,7 +41,7 @@ var startFlags = []cli.Flag{ func startAction(ctx *cli.Context) error { conf := context.NewConfig(ctx) - if conf.GetServerPort() < 1 { + if conf.HttpServerPort() < 1 { log.Fatal("Server port must be a positive integer") } diff --git a/internal/context/config.go b/internal/context/config.go index bb00de40f..ab7ead305 100644 --- a/internal/context/config.go +++ b/internal/context/config.go @@ -331,13 +331,13 @@ func (c *Config) SqlServerPort() uint { return c.sqlServerPort } -// HttpServerHost returns the server host name or IP address (empty for all interfaces). +// HttpServerHost returns the built-in HTTP server host name or IP address (empty for all interfaces). func (c *Config) HttpServerHost() string { return c.httpServerHost } -// GetServerPort returns the server port. -func (c *Config) GetServerPort() int { +// HttpServerPort returns the built-in HTTP server port. +func (c *Config) HttpServerPort() int { return c.httpServerPort } diff --git a/internal/photoprism/config.go b/internal/photoprism/config.go index 115607f51..fc4a53045 100644 --- a/internal/photoprism/config.go +++ b/internal/photoprism/config.go @@ -9,21 +9,25 @@ import ( // Todo: Remove Get prefix, see https://golang.org/doc/effective_go.html#Getters type Config interface { + Debug() bool + Db() *gorm.DB + CreateDirectories() error MigrateDb() - Db() *gorm.DB ClientConfig() frontend.Config - ConfigFile() string + AppName() string AppVersion() string AppCopyright() string - Debug() bool + SqlServerHost() string SqlServerPort() uint + HttpServerHost() string - GetServerPort() int + HttpServerPort() int + GetServerMode() string GetDatabaseDriver() string GetDatabaseDsn() string diff --git a/internal/server/server.go b/internal/server/server.go index d8375c445..34caf6ba4 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -22,5 +22,5 @@ func Start(conf photoprism.Config) { registerRoutes(app, conf) - app.Run(fmt.Sprintf("%s:%d", conf.HttpServerHost(), conf.GetServerPort())) + app.Run(fmt.Sprintf("%s:%d", conf.HttpServerHost(), conf.HttpServerPort())) } diff --git a/internal/test/config.go b/internal/test/config.go index f1ffd8b4c..12cc28a5a 100644 --- a/internal/test/config.go +++ b/internal/test/config.go @@ -183,8 +183,8 @@ func (c *Config) HttpServerHost() string { return "127.0.0.1" } -// GetServerPort returns the server port. -func (c *Config) GetServerPort() int { +// HttpServerPort returns the server port. +func (c *Config) HttpServerPort() int { return 80 }