diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2017-06-03 18:00:51 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2017-06-03 18:00:51 -0400 |
| commit | f154ae1ec88146017abf3de9d14d119facb5fc4c (patch) | |
| tree | cd857864dd52b088ccc8943b64fe9bbd59c04dc8 /config.go | |
| parent | 3f3cb7c7cede379914eed51c57e58f66ffdd1856 (diff) | |
| download | lastfm-api-f154ae1ec88146017abf3de9d14d119facb5fc4c.tar.gz | |
Basic web app
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/config.go b/config.go new file mode 100644 index 0000000..0f0b853 --- /dev/null +++ b/config.go @@ -0,0 +1,34 @@ +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 +} |
