summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-19 18:42:08 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-19 18:42:08 +0200
commitb1a4f38e383279d14d10b6b4575f752ca4b54f73 (patch)
tree813429385388f6ce7f6255d53210ce9ba914e796 /internal/config/config.go
parentDb tls (#102) (diff)
downloadgotosocial-b1a4f38e383279d14d10b6b4575f752ca4b54f73.tar.xz
allow different host + accountDomain (#103)
* allow different host + accountDomain * use accountDomain in tags
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 323b7de81..958926975 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -48,6 +48,7 @@ type Config struct {
LogLevel string `yaml:"logLevel"`
ApplicationName string `yaml:"applicationName"`
Host string `yaml:"host"`
+ AccountDomain string `yaml:"accountDomain"`
Protocol string `yaml:"protocol"`
DBConfig *DBConfig `yaml:"db"`
TemplateConfig *TemplateConfig `yaml:"template"`
@@ -133,6 +134,13 @@ func (c *Config) ParseCLIFlags(f KeyedFlags, version string) error {
return errors.New("host was not set")
}
+ if c.AccountDomain == "" || f.IsSet(fn.AccountDomain) {
+ c.AccountDomain = f.String(fn.AccountDomain)
+ }
+ if c.AccountDomain == "" {
+ c.AccountDomain = c.Host // default to whatever the host is, if this is empty
+ }
+
if c.Protocol == "" || f.IsSet(fn.Protocol) {
c.Protocol = f.String(fn.Protocol)
}
@@ -290,6 +298,7 @@ type Flags struct {
ApplicationName string
ConfigPath string
Host string
+ AccountDomain string
Protocol string
DbType string
@@ -336,6 +345,7 @@ type Defaults struct {
ApplicationName string
ConfigPath string
Host string
+ AccountDomain string
Protocol string
SoftwareVersion string
@@ -385,6 +395,7 @@ func GetFlagNames() Flags {
ApplicationName: "application-name",
ConfigPath: "config-path",
Host: "host",
+ AccountDomain: "account-domain",
Protocol: "protocol",
DbType: "db-type",
@@ -434,6 +445,7 @@ func GetEnvNames() Flags {
ApplicationName: "GTS_APPLICATION_NAME",
ConfigPath: "GTS_CONFIG_PATH",
Host: "GTS_HOST",
+ AccountDomain: "GTS_ACCOUNT_DOMAIN",
Protocol: "GTS_PROTOCOL",
DbType: "GTS_DB_TYPE",