mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-20 09:20:11 +00:00
Added some tests for sharedlibrary
This commit is contained in:
@@ -57,6 +57,18 @@ func (c *ServerConfig) PopulateCalculatedFields() {
|
||||
logger.EnableDebugOutput = c.Debug
|
||||
}
|
||||
|
||||
func (c *ServerConfig) ApplyDefaultsToEmptyFields() {
|
||||
if c.Host == "" {
|
||||
c.Host = "localhost"
|
||||
}
|
||||
if c.Port == 0 {
|
||||
c.Port = 8081
|
||||
}
|
||||
if c.AccountKey == "" {
|
||||
c.AccountKey = DefaultAccountKey
|
||||
}
|
||||
}
|
||||
|
||||
func setFlagsFromEnvironment() (err error) {
|
||||
flag.VisitAll(func(f *flag.Flag) {
|
||||
name := EnvPrefix + strings.ToUpper(strings.Replace(f.Name, "-", "_", -1))
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package config
|
||||
|
||||
type ServerConfig struct {
|
||||
DatabaseAccount string
|
||||
DatabaseDomain string
|
||||
DatabaseEndpoint string
|
||||
AccountKey string
|
||||
DatabaseAccount string `json:"databaseAccount"`
|
||||
DatabaseDomain string `json:"databaseDomain"`
|
||||
DatabaseEndpoint string `json:"databaseEndpoint"`
|
||||
AccountKey string `json:"accountKey"`
|
||||
|
||||
ExplorerPath string
|
||||
Port int
|
||||
Host string
|
||||
TLS_CertificatePath string
|
||||
TLS_CertificateKey string
|
||||
InitialDataFilePath string
|
||||
PersistDataFilePath string
|
||||
DisableAuth bool
|
||||
DisableTls bool
|
||||
Debug bool
|
||||
ExplorerBaseUrlLocation string
|
||||
ExplorerPath string `json:"explorerPath"`
|
||||
Port int `json:"port"`
|
||||
Host string `json:"host"`
|
||||
TLS_CertificatePath string `json:"tlsCertificatePath"`
|
||||
TLS_CertificateKey string `json:"tlsCertificateKey"`
|
||||
InitialDataFilePath string `json:"initialDataFilePath"`
|
||||
PersistDataFilePath string `json:"persistDataFilePath"`
|
||||
DisableAuth bool `json:"disableAuth"`
|
||||
DisableTls bool `json:"disableTls"`
|
||||
Debug bool `json:"debug"`
|
||||
ExplorerBaseUrlLocation string `json:"explorerBaseUrlLocation"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user