Rename Config.GetServerPort() to HttpServerPort, see #50

This commit is contained in:
Michael Mayer 2018-12-21 03:16:50 +01:00
parent cfd70b13f5
commit f0c947ddfb
5 changed files with 15 additions and 11 deletions

View file

@ -41,7 +41,7 @@ var startFlags = []cli.Flag{
func startAction(ctx *cli.Context) error { func startAction(ctx *cli.Context) error {
conf := context.NewConfig(ctx) conf := context.NewConfig(ctx)
if conf.GetServerPort() < 1 { if conf.HttpServerPort() < 1 {
log.Fatal("Server port must be a positive integer") log.Fatal("Server port must be a positive integer")
} }

View file

@ -331,13 +331,13 @@ func (c *Config) SqlServerPort() uint {
return c.sqlServerPort 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 { func (c *Config) HttpServerHost() string {
return c.httpServerHost return c.httpServerHost
} }
// GetServerPort returns the server port. // HttpServerPort returns the built-in HTTP server port.
func (c *Config) GetServerPort() int { func (c *Config) HttpServerPort() int {
return c.httpServerPort return c.httpServerPort
} }

View file

@ -9,21 +9,25 @@ import (
// Todo: Remove Get prefix, see https://golang.org/doc/effective_go.html#Getters // Todo: Remove Get prefix, see https://golang.org/doc/effective_go.html#Getters
type Config interface { type Config interface {
Debug() bool
Db() *gorm.DB
CreateDirectories() error CreateDirectories() error
MigrateDb() MigrateDb()
Db() *gorm.DB
ClientConfig() frontend.Config ClientConfig() frontend.Config
ConfigFile() string ConfigFile() string
AppName() string AppName() string
AppVersion() string AppVersion() string
AppCopyright() string AppCopyright() string
Debug() bool
SqlServerHost() string SqlServerHost() string
SqlServerPort() uint SqlServerPort() uint
HttpServerHost() string HttpServerHost() string
GetServerPort() int HttpServerPort() int
GetServerMode() string GetServerMode() string
GetDatabaseDriver() string GetDatabaseDriver() string
GetDatabaseDsn() string GetDatabaseDsn() string

View file

@ -22,5 +22,5 @@ func Start(conf photoprism.Config) {
registerRoutes(app, conf) registerRoutes(app, conf)
app.Run(fmt.Sprintf("%s:%d", conf.HttpServerHost(), conf.GetServerPort())) app.Run(fmt.Sprintf("%s:%d", conf.HttpServerHost(), conf.HttpServerPort()))
} }

View file

@ -183,8 +183,8 @@ func (c *Config) HttpServerHost() string {
return "127.0.0.1" return "127.0.0.1"
} }
// GetServerPort returns the server port. // HttpServerPort returns the server port.
func (c *Config) GetServerPort() int { func (c *Config) HttpServerPort() int {
return 80 return 80
} }