Added api host guard
This commit is contained in:
@@ -5,11 +5,11 @@ import (
|
||||
)
|
||||
|
||||
type EnvConfig struct {
|
||||
Port string
|
||||
ConfigDir string
|
||||
GithubPat string
|
||||
StoragePath string
|
||||
DatabasePath string
|
||||
Port string
|
||||
ConfigDir string
|
||||
GithubPat string
|
||||
StoragePath string
|
||||
ApiHost string
|
||||
}
|
||||
|
||||
func Load() EnvConfig {
|
||||
@@ -33,10 +33,16 @@ func Load() EnvConfig {
|
||||
storagePath = "./storage"
|
||||
}
|
||||
|
||||
apiHost := os.Getenv("API_HOST")
|
||||
if apiHost == "" {
|
||||
apiHost = "localhost"
|
||||
}
|
||||
|
||||
return EnvConfig{
|
||||
Port: port,
|
||||
ConfigDir: configDir,
|
||||
GithubPat: githubPat,
|
||||
StoragePath: storagePath,
|
||||
ApiHost: apiHost,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user