Add support for PROXY and PORT envs

This commit is contained in:
Ben Sarmiento
2024-04-26 15:11:48 +02:00
parent 2dbabd3ead
commit 6983f59483
3 changed files with 17 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
package config
import "os"
type ConfigInterface interface {
GetConfig() ZurgConfig
GetVersion() string
@@ -80,6 +82,9 @@ func (z *ZurgConfig) GetHost() string {
}
func (z *ZurgConfig) GetPort() string {
if os.Getenv("PORT") != "" {
return os.Getenv("PORT")
}
if z.Port == "" {
return "9999"
}
@@ -95,6 +100,9 @@ func (z *ZurgConfig) GetPassword() string {
}
func (z *ZurgConfig) GetProxy() string {
if os.Getenv("PROXY") != "" {
return os.Getenv("PROXY")
}
return z.Proxy
}