diff options
Diffstat (limited to 'internal/environment')
-rw-r--r-- | internal/environment/environment.go | 10 | ||||
-rw-r--r-- | internal/environment/flags.go | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/internal/environment/environment.go b/internal/environment/environment.go index eac0430..8dad2c9 100644 --- a/internal/environment/environment.go +++ b/internal/environment/environment.go @@ -35,7 +35,6 @@ import ( // Environment struct holds the shoelaces instance global data. type Environment struct { ConfigFile string - BaseURL string HostnameMaps []mappings.HostnameMap NetworkMaps []mappings.NetworkMap ServerStates *server.States @@ -46,8 +45,8 @@ type Environment struct { Environments []string // Valid config environments Logger log.Logger - Port int - Domain string + BindAddr string + BaseURL string DataDir string StaticDir string EnvDir string @@ -66,7 +65,10 @@ func New() *Environment { env.Logger = log.AllowDebug(env.Logger) } - env.BaseURL = fmt.Sprintf("%s:%d", env.Domain, env.Port) + if env.BaseURL == "" { + env.BaseURL = env.BindAddr + } + env.Environments = env.initEnvOverrides() env.EventLog = &event.Log{} diff --git a/internal/environment/flags.go b/internal/environment/flags.go index 8250690..bbb7d1a 100644 --- a/internal/environment/flags.go +++ b/internal/environment/flags.go @@ -23,8 +23,8 @@ import ( func (env *Environment) setFlags() { flag.StringVar(&env.ConfigFile, "config", "", "My config file") - flag.IntVar(&env.Port, "port", 8080, "The port where I'm going to listen") - flag.StringVar(&env.Domain, "domain", "localhost", "The address where I'm going to listen") + flag.StringVar(&env.BindAddr, "bind-addr", "localhost:8081", "The address where I'm going to listen") + flag.StringVar(&env.BaseURL, "base-url", "", "The base shoelaces URL. If it's not defined, it will default to bind-addr.") flag.StringVar(&env.DataDir, "data-dir", "", "Directory with mappings, configs, templates, etc.") flag.StringVar(&env.StaticDir, "static-dir", "web", "A custom web directory with static files") flag.StringVar(&env.EnvDir, "env-dir", "env_overrides", "Directory with overrides") |