Get external url from environment

This commit is contained in:
Peter Stuifzand 2018-05-23 21:04:47 +02:00
parent 0eecb03497
commit 3b808da62a

View File

@ -24,6 +24,7 @@ import (
"log"
"net/http"
"net/url"
"os"
"regexp"
"time"
@ -119,7 +120,7 @@ func (h *hubIncomingBackend) CreateFeed(topic string, channel string) (int64, er
hub, err := url.Parse(hubURL)
q := hub.Query()
q.Add("hub.mode", "subscribe")
q.Add("hub.callback", fmt.Sprintf("https://microsub.stuifzandapp.com/incoming/%d", id))
q.Add("hub.callback", fmt.Sprintf("%s/incoming/%d", os.Getenv("EKSTER_BASEURL"), id))
q.Add("hub.topic", topic)
q.Add("hub.secret", secret)
hub.RawQuery = ""
@ -167,6 +168,10 @@ func main() {
log.Println("eksterd - microsub server")
flag.Parse()
if _, e := os.LookupEnv("EKSTER_BASEURL"); !e {
log.Fatal("EKSTER_BASEURL environment variable not found, please set with external url: https://example.com")
}
createBackend := false
args := flag.Args()