mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 13:30:26 +00:00
Add a -listen-addr flag, remove LISTEN_ADDR/PORT
This commit is contained in:
parent
295c209472
commit
cfc413f1a9
@ -137,21 +137,15 @@ func ReadConfigFile(path string) error {
|
|||||||
// doesn't exist or is empty.
|
// doesn't exist or is empty.
|
||||||
f.MapTo(cfg)
|
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
|
// Map the struct to the global variables
|
||||||
WikiName = cfg.WikiName
|
WikiName = cfg.WikiName
|
||||||
NaviTitleIcon = cfg.NaviTitleIcon
|
NaviTitleIcon = cfg.NaviTitleIcon
|
||||||
HomeHypha = cfg.HomeHypha
|
HomeHypha = cfg.HomeHypha
|
||||||
UserHypha = cfg.UserHypha
|
UserHypha = cfg.UserHypha
|
||||||
HeaderLinksHypha = cfg.HeaderLinksHypha
|
HeaderLinksHypha = cfg.HeaderLinksHypha
|
||||||
ListenAddr = cfg.ListenAddr
|
if ListenAddr == "" {
|
||||||
|
ListenAddr = cfg.ListenAddr
|
||||||
|
}
|
||||||
URL = cfg.URL
|
URL = cfg.URL
|
||||||
UseAuth = cfg.UseAuth
|
UseAuth = cfg.UseAuth
|
||||||
AllowRegistration = cfg.AllowRegistration
|
AllowRegistration = cfg.AllowRegistration
|
||||||
|
1
flag.go
1
flag.go
@ -36,6 +36,7 @@ type CreateUserCommand struct {
|
|||||||
func parseCliArgs() {
|
func parseCliArgs() {
|
||||||
var createAdminName string
|
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.StringVar(&createAdminName, "create-admin", "", "Create a new admin. The password will be prompted in the terminal.")
|
||||||
flag.Usage = printHelp
|
flag.Usage = printHelp
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
Loading…
Reference in New Issue
Block a user