diff --git a/cfg/config.go b/cfg/config.go index 2e1c748..affc8eb 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -137,21 +137,15 @@ func ReadConfigFile(path string) error { // doesn't exist or is empty. f.MapTo(cfg) - if os.Getenv("LISTEN_ADDR") != "" { - cfg.Network.ListenAddr = os.Getenv("LISTEN_ADDR") - } - - if os.Getenv("PORT") != "" { - cfg.Network.ListenAddr = "127.0.0.1:" + os.Getenv("PORT") - } - // Map the struct to the global variables WikiName = cfg.WikiName NaviTitleIcon = cfg.NaviTitleIcon HomeHypha = cfg.HomeHypha UserHypha = cfg.UserHypha HeaderLinksHypha = cfg.HeaderLinksHypha - ListenAddr = cfg.ListenAddr + if ListenAddr == "" { + ListenAddr = cfg.ListenAddr + } URL = cfg.URL UseAuth = cfg.UseAuth AllowRegistration = cfg.AllowRegistration diff --git a/flag.go b/flag.go index 420c0b6..14341d8 100644 --- a/flag.go +++ b/flag.go @@ -36,6 +36,7 @@ type CreateUserCommand struct { func parseCliArgs() { var createAdminName string + flag.StringVar(&cfg.ListenAddr, "listen-addr", "", "Address to listen on. For example, 127.0.0.1:1737 or /run/mycorrhiza.sock.") flag.StringVar(&createAdminName, "create-admin", "", "Create a new admin. The password will be prompted in the terminal.") flag.Usage = printHelp flag.Parse()