diff --git a/.env.example b/.env.example index c279942..8e9802a 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,7 @@ IPV6_CAPABLE=false # Server Config # ############# +APP_URL="https://xmr.ditatompel.com" # URL where user can access the web UI, don't put trailing slash # Fiber Config APP_PREFORK=false diff --git a/internal/config/app.go b/internal/config/app.go index 10599c4..af71eb7 100644 --- a/internal/config/app.go +++ b/internal/config/app.go @@ -13,6 +13,9 @@ type App struct { LogLevel string // configuration for server + URL string // URL where user can access the web UI, don't put trailing slash + + // fiber specific config Prefork bool Host string Port int @@ -55,6 +58,9 @@ func LoadApp() { } // server configuration + app.URL = os.Getenv("APP_URL") + + // fiber specific config app.Host = os.Getenv("APP_HOST") app.Port, _ = strconv.Atoi(os.Getenv("APP_PORT")) app.Prefork, _ = strconv.ParseBool(os.Getenv("APP_PREFORK")) diff --git a/internal/handler/response.go b/internal/handler/response.go index 57f2b96..bf375cc 100644 --- a/internal/handler/response.go +++ b/internal/handler/response.go @@ -20,7 +20,7 @@ func (s *fiberServer) homeHandler(c *fiber.Ctx) error { Description: "A website that helps you monitor your favourite Monero remote nodes, but YOU BETTER RUN AND USE YOUR OWN NODE.", Keywords: "monero,monero,xmr,monero node,xmrnode,cryptocurrency,monero remote node,monero testnet,monero stagenet", Robots: "INDEX,FOLLOW", - Permalink: "https://xmr.ditatompel.com", + Permalink: s.url, Identifier: "/", } @@ -61,7 +61,7 @@ func (s *fiberServer) addNodeHandler(c *fiber.Ctx) error { Description: "You can use this page to add known remote node to the system so my bots can monitor it.", Keywords: "monero,monero node,monero public node,monero wallet,list monero node,monero node monitoring", Robots: "INDEX,FOLLOW", - Permalink: "https://xmr.ditatompel.com/add-node", + Permalink: s.url + "/add-node", Identifier: "/add-node", } @@ -115,7 +115,7 @@ func (s *fiberServer) remoteNodesHandler(c *fiber.Ctx) error { Description: "Although it's possible to use these existing public Monero nodes, you're MUST RUN AND USE YOUR OWN NODE!", Keywords: "monero remote nodes,public monero nodes,monero public nodes,monero wallet,tor monero node,monero cors rpc", Robots: "INDEX,FOLLOW", - Permalink: "https://xmr.ditatompel.com/remote-nodes", + Permalink: s.url + "/remote-nodes", Identifier: "/remote-nodes", } @@ -241,7 +241,7 @@ func (s *fiberServer) nodeHandler(c *fiber.Ctx) error { Description: fmt.Sprintf("Monero %s remote node %s running on port %d", node.Nettype, node.Hostname, node.Port), Keywords: fmt.Sprintf("monero log,monero node log,monitoring monero log,monero,xmr,monero node,xmrnode,cryptocurrency,monero %s,%s", node.Nettype, node.Hostname), Robots: "INDEX,FOLLOW", - Permalink: fmt.Sprintf("https://xmr.ditatompel.com/remote-nodes/id/%d", node.ID), + Permalink: s.url + "/remote-nodes/id/" + strconv.Itoa(int(node.ID)), Identifier: "/remote-nodes", } diff --git a/internal/handler/server.go b/internal/handler/server.go index acc7452..0a7b48e 100644 --- a/internal/handler/server.go +++ b/internal/handler/server.go @@ -8,7 +8,8 @@ import ( type fiberServer struct { *fiber.App - db *database.DB + db *database.DB + url string } // NewServer returns a new fiber server @@ -22,7 +23,8 @@ func NewServer() *fiberServer { ProxyHeader: config.AppCfg().ProxyHeader, AppName: "XMR Nodes Aggregator " + config.Version, }), - db: database.GetDB(), + db: database.GetDB(), + url: config.AppCfg().URL, } return server