Commit 5ed939f1 authored by zauberstuhl's avatar zauberstuhl

Optimize InitSocialRelay and print more debug msgs

related to https://github.com/thefederationinfo/the-federation.info/pull/162
parent c7b1153f
Pipeline #960 passed with stages
in 21 minutes and 30 seconds
......@@ -73,14 +73,23 @@ func InitSocialRelay() {
// this is required for using the social-relay
revel.Config.SetSection("ganggo")
subscribe := revel.Config.BoolDefault("relay.subscribe", false)
if !revel.DevMode && subscribe {
address, found := revel.Config.String("address")
if found {
_, err := http.Get("https://the-federation.info/register/" + address)
if err != nil {
revel.WARN.Println("Wasn't able to register at the-federation.info", err)
}
address, found := revel.Config.String("address")
if !revel.DevMode && subscribe && found {
result := struct{Error string `json:"error"`}{}
endpoint := fmt.Sprintf(revel.Config.StringDefault(
"relay.endpoint", "https://the-federation.info/register/%s",
), address)
err := federation.FetchJson("GET", endpoint, nil, &result)
if err != nil {
revel.AppLog.Error("InitSocialRelay failed",
"result", result, "err", err)
} else {
revel.AppLog.Info("InitSocialRelay registration", "result", result)
}
} else {
revel.AppLog.Info("InitSocialRelay skipped",
"devMode", revel.DevMode, "subscribe", subscribe)
}
}
......
......@@ -51,6 +51,8 @@ relay.subscribe = false
#relay.scope = "all"
# This option is obsolete if you specified "all" in "relay.scope"
#relay.tags = "social,network,politics"
# DO NOT touch unless you know exactly what you are doing
#relay.endpoint = "https://the-federation.info/register/%s"
[DEFAULT]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment