summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-11-22 10:55:52 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-22 10:55:52 +0100
commit1ded58b34b72c8e6862c5614882fd5a3bb430aaa (patch)
treea57350333cf51100fca3ecb21152626a03e0bed3 /internal/config/config.go
parentproperly initialize user client module (#319) (diff)
downloadgotosocial-1ded58b34b72c8e6862c5614882fd5a3bb430aaa.tar.xz
add bindAddress configuration option (#320)
* add bindAddress configuration option * clarify that bindAddress can be a hostname
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 7a3a92af9..9daeba0f0 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -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",