-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.go
58 lines (47 loc) · 1.01 KB
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package settings
import (
"encoding/json"
"io/ioutil"
"os"
)
type AppSettings struct {
Host string
Port int
Debug bool
}
type PaymentGateSettings struct {
BitcoinInsightAPIURL string `json:"bitcoin_insight_api_url"`
EthereumAPIURL string `json:"etherium_api_url"`
BTCCommissionWallet string `json:"btc_commission_wallet"`
BCHCommissionWallet string `json:"bch_commission_wallet"`
PostgresConnectionString string `json:"pg_connection_string"`
EtherscanAPIKey string `json:"etherscan_api_key"`
}
/*
Utility Functions
*/
func LoadPaymentGateSettings() PaymentGateSettings {
var (
settings PaymentGateSettings
)
file, err := ioutil.ReadFile("settings.json")
if err != nil {
panic(err)
}
err = json.Unmarshal(file, &settings)
if err != nil {
panic(err)
}
return settings
}
/*
Globals
*/
var (
APPLICATION_SETTINGS = AppSettings{
Host: "127.0.0.1",
Port: 8083,
Debug: os.Getenv("PAYAKA_DEBUG") == "1",
}
PAYMENT_GATE_SETTINGS = LoadPaymentGateSettings()
)