mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
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
This commit is contained in:
parent
ec716793eb
commit
c9419e51af
28 changed files with 83 additions and 61 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue