summaryrefslogtreecommitdiffstats
path: root/config.go
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2017-06-03 18:00:51 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2017-06-03 18:00:51 -0400
commitf154ae1ec88146017abf3de9d14d119facb5fc4c (patch)
treecd857864dd52b088ccc8943b64fe9bbd59c04dc8 /config.go
parent3f3cb7c7cede379914eed51c57e58f66ffdd1856 (diff)
downloadlastfm-api-f154ae1ec88146017abf3de9d14d119facb5fc4c.tar.gz
Basic web app
Diffstat (limited to 'config.go')
-rw-r--r--config.go34
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
+}