Add logging config and add some helper functions
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
as "maunium.net/go/mautrix/appservice"
|
||||
)
|
||||
|
||||
type appservice struct {
|
||||
Address string `yaml:"address"`
|
||||
Hostname string `yaml:"hostname"`
|
||||
@@ -49,3 +53,16 @@ func (a *appservice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
|
||||
return a.validate()
|
||||
}
|
||||
|
||||
func (cfg *Config) CreateAppService() (*as.AppService, error) {
|
||||
appservice := as.Create()
|
||||
|
||||
appservice.HomeserverURL = cfg.Homeserver.Address
|
||||
appservice.HomeserverDomain = cfg.Homeserver.Domain
|
||||
|
||||
appservice.Host.Hostname = cfg.Appservice.Hostname
|
||||
appservice.Host.Port = cfg.Appservice.Port
|
||||
appservice.DefaultHTTPRetries = 4
|
||||
|
||||
return appservice, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user