summaryrefslogtreecommitdiffstats
path: root/config.go
blob: 0f0b853156efd7900d4a55bc1e0eb65a1475f70f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
}