diff --git a/conf/dadi.json b/conf/dadi.json new file mode 100644 index 0000000..ac2fa8d --- /dev/null +++ b/conf/dadi.json @@ -0,0 +1,4 @@ +{ + "bidProfit": 50, + "couponCost": 3000 +} \ No newline at end of file diff --git a/config/daid.go b/config/daid.go new file mode 100644 index 0000000..55685a2 --- /dev/null +++ b/config/daid.go @@ -0,0 +1,30 @@ +package config + +import ( + "encoding/json" + "io/ioutil" +) + +type Dadi struct { + BidProfit int64 `json:"bidProfit"` + CouponCost int64 `json:"couponCost"` +} + +var ( + dadiConfig *Dadi = nil +) + +func LoadDadiConfig() { + body, err := ioutil.ReadFile("conf/dadi.json") + if err != nil { + panic(err) + } + dadiConfig = new(Dadi) + if err := json.Unmarshal([]byte(body), dadiConfig); err != nil { + panic(err) + } +} + +func GetDadiConfig() *Dadi { + return dadiConfig +}