aboutsummaryrefslogtreecommitdiffstats
path: root/config.go
diff options
context:
space:
mode:
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
+}