-
Notifications
You must be signed in to change notification settings - Fork 52
/
config.go
53 lines (43 loc) · 955 Bytes
/
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
52
53
package main
import (
"github.com/BurntSushi/toml"
)
type tomlConfig struct {
Database Database `toml:"Database"`
AquametaUser AquametaUser `toml:"AquametaUser"`
HTTPServer HTTPServer `toml:"HTTPServer"`
PGFS PGFS `toml:"PGFS"`
}
type Database struct {
Mode string
Role string
Password string
Host string
Port uint32
DatabaseName string
EmbeddedPostgresRuntimePath string
}
type AquametaUser struct {
Name string
Email string
}
// TODO: This belongs in the database
type HTTPServer struct {
Protocol string
IP string
Port string
SSLCertificateFile string
SSLKeyFile string
StartupURL string
}
type PGFS struct {
Enabled bool
MountDirectory string
}
func getConfig(configFile string) (tomlConfig, error) {
var config tomlConfig
if _, err := toml.DecodeFile(configFile, &config); err != nil {
return config, err
}
return config, nil
}