add bindAddress configuration option (#320)

* add bindAddress configuration option

* clarify that bindAddress can be a hostname
This commit is contained in:
tobi
2021-11-22 10:55:52 +01:00
committed by GitHub
parent 6c0550e76f
commit 1ded58b34b
6 changed files with 42 additions and 3 deletions

View File

@@ -53,6 +53,7 @@ type Config struct {
Host string `yaml:"host"`
AccountDomain string `yaml:"accountDomain"`
Protocol string `yaml:"protocol"`
BindAddress string `yaml:"bindAddress"`
Port int `yaml:"port"`
TrustedProxies []string `yaml:"trustedProxies"`
DBConfig *DBConfig `yaml:"db"`
@@ -159,6 +160,10 @@ func (c *Config) ParseCLIFlags(f KeyedFlags, version string) error {
return errors.New("protocol was not set")
}
if c.BindAddress == "" || f.IsSet(fn.BindAddress) {
c.BindAddress = f.String(fn.BindAddress)
}
if c.Port == 0 || f.IsSet(fn.Port) {
c.Port = f.Int(fn.Port)
}
@@ -374,6 +379,7 @@ type Flags struct {
Host string
AccountDomain string
Protocol string
BindAddress string
Port string
TrustedProxies string
@@ -438,6 +444,7 @@ type Defaults struct {
Host string
AccountDomain string
Protocol string
BindAddress string
Port int
TrustedProxies []string
SoftwareVersion string
@@ -505,6 +512,7 @@ func GetFlagNames() Flags {
Host: "host",
AccountDomain: "account-domain",
Protocol: "protocol",
BindAddress: "bind-address",
Port: "port",
TrustedProxies: "trusted-proxies",
@@ -572,6 +580,7 @@ func GetEnvNames() Flags {
Host: "GTS_HOST",
AccountDomain: "GTS_ACCOUNT_DOMAIN",
Protocol: "GTS_PROTOCOL",
BindAddress: "GTS_BIND_ADDRESS",
Port: "GTS_PORT",
TrustedProxies: "GTS_TRUSTED_PROXIES",