TheMathemagicians/sevenkeys/config/config.go

30 lines
490 B
Go
Raw Permalink Normal View History

package config
import (
"encoding/json"
"log"
"os"
"github.com/go-sql-driver/mysql"
)
type SevenkeysConfig struct {
DatabaseConfig mysql.Config `json:"DatabaseConfig"`
CardtraderToken string `json:"CardtraderToken"`
}
func ReadConfigFromFile(filename string) SevenkeysConfig {
bytes, err := os.ReadFile(filename)
if err != nil {
log.Fatal(err)
}
var config SevenkeysConfig
err = json.Unmarshal(bytes, &config)
if err != nil {
log.Fatal(err)
}
return config
}