package config import "github.com/photoprism/photoprism/pkg/fs" // DetachServer returns true if server should detach from console (daemon mode). func (c *Config) DetachServer() bool { return c.config.DetachServer } // HttpServerHost returns the built-in HTTP server host name or IP address (empty for all interfaces). func (c *Config) HttpServerHost() string { if c.config.HttpServerHost == "" { return "0.0.0.0" } return c.config.HttpServerHost } // HttpServerPort returns the built-in HTTP server port. func (c *Config) HttpServerPort() int { if c.config.HttpServerPort == 0 { return 2342 } return c.config.HttpServerPort } // HttpServerMode returns the server mode. func (c *Config) HttpServerMode() string { if c.config.HttpServerMode == "" { if c.Debug() { return "debug" } return "release" } return c.config.HttpServerMode } // HttpServerPassword returns the password for the user interface (optional). func (c *Config) HttpServerPassword() string { return c.config.HttpServerPassword } // HttpTemplatesPath returns the server templates path. func (c *Config) HttpTemplatesPath() string { return c.ResourcesPath() + "/templates" } // HttpFaviconsPath returns the favicons path. func (c *Config) HttpFaviconsPath() string { return c.HttpStaticPath() + "/favicons" } // HttpStaticPath returns the static server assets path (//server/static/*). func (c *Config) HttpStaticPath() string { return c.ResourcesPath() + "/static" } // HttpStaticBuildPath returns the static build path (//server/static/build/*). func (c *Config) HttpStaticBuildPath() string { return c.HttpStaticPath() + "/build" } // SqlServerHost returns the built-in SQL server host name or IP address (empty for all interfaces). func (c *Config) SqlServerHost() string { if c.config.SqlServerHost == "" { return "127.0.0.1" } return c.config.SqlServerHost } // SqlServerPort returns the built-in SQL server port. func (c *Config) SqlServerPort() uint { if c.config.SqlServerPort == 0 { return 4000 } return c.config.SqlServerPort } // SqlServerPath returns the database storage path for TiDB. func (c *Config) SqlServerPath() string { if c.config.SqlServerPath == "" { return c.ResourcesPath() + "/database" } return fs.Abs(c.config.SqlServerPath) } // SqlServerPassword returns the password for the built-in database server. func (c *Config) SqlServerPassword() string { return c.config.SqlServerPassword }