Allow baseurl for databridge to be altered.

This commit is contained in:
Jim Myers 2021-11-08 11:51:51 -05:00
parent cd9c4b3233
commit 7a8513e754

View File

@ -4,6 +4,7 @@ package databridge
type Config struct {
APIKey string
TopicSlug string
BaseURL string
}
// Client allows access to the Databridge API
@ -17,7 +18,11 @@ type Client struct {
func NewClient(config Config) (Client, error) {
c := Client{}
c.APIKey = config.APIKey
c.BaseURL = "https://data-bridge.flipsidecrypto.com/api/v1"
if config.BaseURL != "" {
c.BaseURL = config.BaseURL
} else {
c.BaseURL = "https://data-bridge.flipsidecrypto.com/api/v1"
}
c.TopicSlug = config.TopicSlug
return c, nil