2020-08-10 13:18:04 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
type KeyServer struct {
|
|
|
|
Matrix *Global `yaml:"-"`
|
|
|
|
|
2020-08-13 11:16:37 +00:00
|
|
|
InternalAPI InternalAPIOptions `yaml:"internal_api"`
|
2020-08-10 13:18:04 +00:00
|
|
|
|
|
|
|
Database DatabaseOptions `yaml:"database"`
|
|
|
|
}
|
|
|
|
|
2021-11-24 11:57:39 +00:00
|
|
|
func (c *KeyServer) Defaults(generate bool) {
|
2020-08-13 11:16:37 +00:00
|
|
|
c.InternalAPI.Listen = "http://localhost:7779"
|
|
|
|
c.InternalAPI.Connect = "http://localhost:7779"
|
2021-03-08 13:18:29 +00:00
|
|
|
c.Database.Defaults(10)
|
2021-11-24 11:57:39 +00:00
|
|
|
if generate {
|
|
|
|
c.Database.ConnectionString = "file:keyserver.db"
|
|
|
|
}
|
2020-08-10 13:18:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *KeyServer) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
2020-08-13 11:16:37 +00:00
|
|
|
checkURL(configErrs, "key_server.internal_api.listen", string(c.InternalAPI.Listen))
|
|
|
|
checkURL(configErrs, "key_server.internal_api.bind", string(c.InternalAPI.Connect))
|
2022-05-03 15:35:06 +00:00
|
|
|
if c.Matrix.DatabaseOptions.ConnectionString == "" {
|
|
|
|
checkNotEmpty(configErrs, "key_server.database.connection_string", string(c.Database.ConnectionString))
|
|
|
|
}
|
2020-08-10 13:18:04 +00:00
|
|
|
}
|