diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2021-11-24 11:57:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 11:57:39 +0000 |
commit | c9419e51afeb0c8cb39a43bd8a0d0d472347a8a1 (patch) | |
tree | 7b425f81fe82f73c80857799a35d0ad6a004db4a /setup/config/config_global.go | |
parent | ec716793eb86e7723ecfaa356e148334bc3921eb (diff) |
Don't populate config defaults where it doesn't make sense (#2058)
* Don't populate config defaults where it doesn't make sense
* Fix dendritejs builds
Diffstat (limited to 'setup/config/config_global.go')
-rw-r--r-- | setup/config/config_global.go | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/setup/config/config_global.go b/setup/config/config_global.go index d5d9f7f5..20ee6d37 100644 --- a/setup/config/config_global.go +++ b/setup/config/config_global.go @@ -59,15 +59,17 @@ type Global struct { DNSCache DNSCacheOptions `yaml:"dns_cache"` } -func (c *Global) Defaults() { - c.ServerName = "localhost" - c.PrivateKeyPath = "matrix_key.pem" - _, c.PrivateKey, _ = ed25519.GenerateKey(rand.New(rand.NewSource(0))) - c.KeyID = "ed25519:auto" +func (c *Global) Defaults(generate bool) { + if generate { + c.ServerName = "localhost" + c.PrivateKeyPath = "matrix_key.pem" + _, c.PrivateKey, _ = ed25519.GenerateKey(rand.New(rand.NewSource(0))) + c.KeyID = "ed25519:auto" + } c.KeyValidityPeriod = time.Hour * 24 * 7 - c.Kafka.Defaults() - c.Metrics.Defaults() + c.Kafka.Defaults(generate) + c.Metrics.Defaults(generate) c.DNSCache.Defaults() c.Sentry.Defaults() } @@ -110,10 +112,12 @@ type Metrics struct { } `yaml:"basic_auth"` } -func (c *Metrics) Defaults() { +func (c *Metrics) Defaults(generate bool) { c.Enabled = false - c.BasicAuth.Username = "metrics" - c.BasicAuth.Password = "metrics" + if generate { + c.BasicAuth.Username = "metrics" + c.BasicAuth.Password = "metrics" + } } func (c *Metrics) Verify(configErrs *ConfigErrors, isMonolith bool) { |