allocate yp at launch to allow for enabling it later

This commit is contained in:
Gabe Kangas 2021-03-04 01:48:10 -08:00
parent 49bb899d51
commit a67e938875
2 changed files with 5 additions and 3 deletions

View File

@ -63,9 +63,7 @@ func Start() error {
return err return err
} }
if data.GetDirectoryEnabled() { _yp = yp.NewYP(GetStatus)
_yp = yp.NewYP(GetStatus)
}
chat.Setup(ChatListenerImpl{}) chat.Setup(ChatListenerImpl{})

View File

@ -60,6 +60,10 @@ func (yp *YP) Stop() {
} }
func (yp *YP) ping() { func (yp *YP) ping() {
if !data.GetDirectoryEnabled() {
return
}
myInstanceURL := data.GetServerURL() myInstanceURL := data.GetServerURL()
if myInstanceURL == "" { if myInstanceURL == "" {
log.Warnln("Server URL not set in the configuration. Directory access is disabled until this is set.") log.Warnln("Server URL not set in the configuration. Directory access is disabled until this is set.")