Allow binding HTTP server to specific address (#831)

Improves security when running with placeholder keys. Only allowing
access from loopback by default.
This commit is contained in:
David Zhao
2022-07-13 23:58:33 -07:00
committed by GitHub
parent af93954c26
commit a2bf32797b
5 changed files with 78 additions and 40 deletions
+4 -1
View File
@@ -30,6 +30,7 @@ const (
type Config struct {
Port uint32 `yaml:"port"`
BindAddresses []string `yaml:"bind_addresses"`
PrometheusPort uint32 `yaml:"prometheus_port,omitempty"`
RTC RTCConfig `yaml:"rtc,omitempty"`
Redis RedisConfig `yaml:"redis,omitempty"`
@@ -347,7 +348,9 @@ func (conf *Config) updateFromCLI(c *cli.Context) error {
if c.IsSet("udp-port") {
conf.RTC.UDPPort = uint32(c.Int("udp-port"))
}
if c.IsSet("bind") {
conf.BindAddresses = c.StringSlice("bind")
}
return nil
}