diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-11 18:13:30 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-11 18:14:07 -0400 |
commit | 6dad1372a4680f2314a057b831f8cb2ef44dcf1b (patch) | |
tree | d95c10c760045c27714bc0b387f06ca8d2771eae /svc/conf.go | |
parent | d4af885c40ba55ea0ed9adade98afe0658099c47 (diff) | |
download | getwtxt-6dad1372a4680f2314a057b831f8cb2ef44dcf1b.tar.gz |
check if behind reverse proxy
Diffstat (limited to 'svc/conf.go')
-rw-r--r-- | svc/conf.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/svc/conf.go b/svc/conf.go index 90cac6a..f15bd13 100644 --- a/svc/conf.go +++ b/svc/conf.go @@ -15,6 +15,7 @@ import ( // this struct. type Configuration struct { Mu sync.RWMutex + IsProxied bool `yaml:"BehindProxy"` Port int `yaml:"ListenPort"` LogFile string `yaml:"LogFile"` DBType string `yaml:"DatabaseType"` @@ -132,6 +133,7 @@ func parseConfigFlag() { func bindConfig() { confObj.Mu.Lock() + confObj.IsProxied = viper.GetBool("BehindProxy") confObj.Port = viper.GetInt("ListenPort") confObj.LogFile = viper.GetString("LogFile") confObj.DBType = strings.ToLower(viper.GetString("DatabaseType")) @@ -157,7 +159,15 @@ func bindConfig() { if *flagAssets != "" { confObj.AssetsDir = *flagAssets } + if *flagProxied { + confObj.IsProxied = true + } + if confObj.IsProxied { + log.Printf("Behind reverse proxy, not using host matching\n") + } else { + log.Printf("Matching host: %v\n", confObj.Instance.URL) + } if confObj.StdoutLogging { log.Printf("Logging to: stdout\n") } else { |