mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Removing logging, return errors and check types
This commit is contained in:
parent
0a8d2325d3
commit
904b586e65
|
|
@ -123,4 +123,4 @@ tracing:
|
||||||
|
|
||||||
# A list of application service config files to use
|
# A list of application service config files to use
|
||||||
applicationservice:
|
applicationservice:
|
||||||
app_service_config_files:
|
app_service_config_files: []
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ type ApplicationService struct {
|
||||||
// Localpart of application service user
|
// Localpart of application service user
|
||||||
SenderLocalpart string `yaml:"sender_localpart"`
|
SenderLocalpart string `yaml:"sender_localpart"`
|
||||||
// Information about an application service's namespaces
|
// Information about an application service's namespaces
|
||||||
Namespaces map[string][]interface{} `yaml:"namespaces"`
|
Namespaces map[string][]ApplicationServiceNamespace `yaml:"namespaces"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadAppservices(config *Dendrite) error {
|
func loadAppservices(config *Dendrite) error {
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,8 @@ func loadConfig(
|
||||||
|
|
||||||
for _, certPath := range config.Matrix.FederationCertificatePaths {
|
for _, certPath := range config.Matrix.FederationCertificatePaths {
|
||||||
absCertPath := absPath(basePath, certPath)
|
absCertPath := absPath(basePath, certPath)
|
||||||
pemData, err := readFile(absCertPath)
|
var pemData []byte
|
||||||
|
pemData, err = readFile(absCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -348,14 +349,17 @@ func loadConfig(
|
||||||
config.Media.AbsBasePath = Path(absPath(basePath, config.Media.BasePath))
|
config.Media.AbsBasePath = Path(absPath(basePath, config.Media.BasePath))
|
||||||
|
|
||||||
// Generate data from config options
|
// Generate data from config options
|
||||||
config.derive()
|
err = config.derive()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &config, nil
|
return &config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// derive generates data that is derived from various values provided in
|
// derive generates data that is derived from various values provided in
|
||||||
// the config file.
|
// the config file.
|
||||||
func (config *Dendrite) derive() {
|
func (config *Dendrite) derive() error {
|
||||||
// Determine registrations flows based off config values
|
// Determine registrations flows based off config values
|
||||||
|
|
||||||
config.Derived.Registration.Params = make(map[string]interface{})
|
config.Derived.Registration.Params = make(map[string]interface{})
|
||||||
|
|
@ -373,12 +377,13 @@ func (config *Dendrite) derive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load application service configuration files
|
// Load application service configuration files
|
||||||
fmt.Println(config.ApplicationService.ConfigFiles)
|
|
||||||
if len(config.ApplicationService.ConfigFiles) > 0 {
|
if len(config.ApplicationService.ConfigFiles) > 0 {
|
||||||
if err := loadAppservices(config); err != nil {
|
if err := loadAppservices(config); err != nil {
|
||||||
fmt.Println("Error loading AS config: ", err)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDefaults sets default config values if they are not explicitly set.
|
// setDefaults sets default config values if they are not explicitly set.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue