Skip to content
Permalink
Browse files

Cors

  • Loading branch information
eabz committed Dec 28, 2019
1 parent 7f8fde8 commit 70b0d44b646e21e753e1d11a0f670dd4268c1867
Showing with 7 additions and 3 deletions.
  1. +4 −1 configs/coins/polis.json
  2. +3 −2 server/public.go
@@ -58,7 +58,10 @@
"block_addresses_to_keep": 300,
"xpub_magic": 65166718,
"slip44": 1997,
"additional_params": {}
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"polis\", \"periodSeconds\": 60}"
}
}
},
"meta": {
@@ -21,7 +21,7 @@ import (
"strconv"
"strings"
"time"

"github.com/rs/cors"
"github.com/golang/glog"
)

@@ -110,14 +110,15 @@ func NewPublicServer(binding string, certFiles string, db *db.RocksDB, chain bch
serveMux.HandleFunc(path, s.htmlTemplateHandler(s.explorerIndex))
// default API handler
serveMux.HandleFunc(path+"api/", s.jsonHandler(s.apiIndex, apiV2))

cors.Default().Handler(serveMux)
return s, nil
}

// Run starts the server
func (s *PublicServer) Run() error {
if s.certFiles == "" {
glog.Info("public server: starting to listen on http://", s.https.Addr)

return s.https.ListenAndServe()
}
glog.Info("public server starting to listen on https://", s.https.Addr)

0 comments on commit 70b0d44

Please sign in to comment.
You can’t perform that action at this time.