package main import ( "encoding/json" "io/ioutil" "log" "golang.org/x/oauth2" "golang.org/x/oauth2/google" ) type Config struct { OAuth oauth2.Config HashKey string BlockKey string Database string Lfm LfmConfig } type LfmConfig struct { ApiKey string SharedSecret string } func NewConfig() *Config { f, err := ioutil.ReadFile("config.json") if err != nil { log.Fatal(err) } conf := new(Config) json.Unmarshal(f, conf) conf.OAuth.Endpoint = google.Endpoint return conf }