diff --git a/proxy/main.go b/proxy/main.go index c8008b0..18f7bf5 100644 --- a/proxy/main.go +++ b/proxy/main.go @@ -36,6 +36,8 @@ import ( "github.com/dlintw/goconf" "github.com/gorilla/mux" + + signaling "github.com/strukturag/nextcloud-spreed-signaling" ) var ( @@ -90,7 +92,7 @@ func main() { } defer proxy.Stop() - if addr, _ := config.GetString("http", "listen"); addr != "" { + if addr, _ := signaling.GetStringOptionWithEnv(config, "http", "listen"); addr != "" { readTimeout, _ := config.GetInt("http", "readtimeout") if readTimeout <= 0 { readTimeout = defaultReadTimeout diff --git a/proxy/proxy_server.go b/proxy/proxy_server.go index 6978c0e..b0842df 100644 --- a/proxy/proxy_server.go +++ b/proxy/proxy_server.go @@ -223,7 +223,7 @@ func (s *ProxyServer) checkOrigin(r *http.Request) bool { } func (s *ProxyServer) Start(config *goconf.ConfigFile) error { - s.url, _ = config.GetString("mcu", "url") + s.url, _ = signaling.GetStringOptionWithEnv(config, "mcu", "url") if s.url == "" { return fmt.Errorf("No MCU server url configured") } diff --git a/proxy_config_static.go b/proxy_config_static.go index 84f7548..eda67d7 100644 --- a/proxy_config_static.go +++ b/proxy_config_static.go @@ -86,7 +86,7 @@ func (p *proxyConfigStatic) configure(config *goconf.ConfigFile, fromReload bool remove[u] = ips } - mcuUrl, _ := config.GetString("mcu", "url") + mcuUrl, _ := GetStringOptionWithEnv(config, "mcu", "url") for _, u := range strings.Split(mcuUrl, " ") { u = strings.TrimSpace(u) if u == "" { diff --git a/server/main.go b/server/main.go index 05f32c3..9ee6afd 100644 --- a/server/main.go +++ b/server/main.go @@ -171,7 +171,7 @@ func main() { signaling.RegisterStats() - natsUrl, _ := config.GetString("nats", "url") + natsUrl, _ := signaling.GetStringOptionWithEnv(config, "nats", "url") if natsUrl == "" { natsUrl = nats.DefaultURL } @@ -224,7 +224,7 @@ func main() { log.Fatal("Could not create hub: ", err) } - mcuUrl, _ := config.GetString("mcu", "url") + mcuUrl, _ := signaling.GetStringOptionWithEnv(config, "mcu", "url") mcuType, _ := config.GetString("mcu", "type") if mcuType == "" && mcuUrl != "" { log.Printf("WARNING: Old-style MCU configuration detected with url but no type, defaulting to type %s", signaling.McuTypeJanus) @@ -274,7 +274,7 @@ func main() { if config, err = goconf.ReadConfigFile(*configFlag); err != nil { log.Printf("Could not read configuration from %s: %s", *configFlag, err) } else { - mcuUrl, _ = config.GetString("mcu", "url") + mcuUrl, _ = signaling.GetStringOptionWithEnv(config, "mcu", "url") mcuType, _ = config.GetString("mcu", "type") if mcuType == "" && mcuUrl != "" { log.Printf("WARNING: Old-style MCU configuration detected with url but no type, defaulting to type %s", signaling.McuTypeJanus) @@ -328,7 +328,7 @@ func main() { var listeners Listeners - if saddr, _ := config.GetString("https", "listen"); saddr != "" { + if saddr, _ := signaling.GetStringOptionWithEnv(config, "https", "listen"); saddr != "" { cert, _ := config.GetString("https", "certificate") key, _ := config.GetString("https", "key") if cert == "" || key == "" { @@ -366,7 +366,7 @@ func main() { } } - if addr, _ := config.GetString("http", "listen"); addr != "" { + if addr, _ := signaling.GetStringOptionWithEnv(config, "http", "listen"); addr != "" { readTimeout, _ := config.GetInt("http", "readtimeout") if readTimeout <= 0 { readTimeout = defaultReadTimeout