-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
51 lines (45 loc) · 1.14 KB
/
config.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"code.google.com/p/gcfg"
"log"
)
type config struct {
GitHub struct {
Authurl string `gcfg:"authurl"`
Tokenurl string `gcfg:"tokenurl"`
Apiurl string `gcfg:"apiurl"`
ClientID string `gcfg:"client-id"`
ClientSecret string `gcfg:"client-secret"`
Scope string `gcfg:"scope"`
Organization string `gcfg:"organization"`
}
Session struct {
AuthenticationKey string `gcfg:"authentication-key"`
EncryptionKey string `gcfg:"encryption-key"`
MaxAge int `gcfg:"max-age"`
}
Server struct {
Bind string `gcfg:"bind"`
Port int `gcfg:"port"`
Fqdn string `gcfg:"fqdn"`
LogLevel string `gcfg:"loglevel"`
}
ReverseProxy map[string]*struct {
To []string `gcfg:"to"`
IdentityRequired bool `gcfg:"identity-required"`
}
IPWhitelist struct {
IP []string `gcfg:"ip"`
}
}
func getConfig() config {
var conf config
err := gcfg.ReadFileInto(&conf, "authproxy.gcfg")
if err != nil {
err2 := gcfg.ReadFileInto(&conf, "/etc/authproxy/authproxy.gcfg")
if err2 != nil {
log.Fatalf("Problem loading config file: %+v\n", err)
}
}
return conf
}