/
config.go
43 lines (38 loc) · 1 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
package config
import (
"github.com/BurntSushi/toml"
log "github.com/Sirupsen/logrus"
"github.com/juju/errors"
)
// Config is the application-wide config
var Config AppConfig
func init() {
err := parseConfigFile(&Config, "config.toml")
if err != nil {
log.Fatal(err)
}
log.Infof("%+v", Config)
}
// parseConfigFile parses the specified file into a given struct
func parseConfigFile(config *AppConfig, filename string) error {
if _, err := toml.DecodeFile(filename, config); err != nil {
return errors.Trace(err)
}
return nil
}
// AppConfig contains the app config variables.
type AppConfig struct {
BackblazeAccountID string
BackblazeApplicationKey string
BackblazeBucket string
Debug bool
EmailUsername string
EmailPassword string
EmailSMTPServer string
EmailPort int
IBMUsername string
IBMPassword string
MongoURL string
Port int
SecretKey string
}