aboutsummaryrefslogtreecommitdiff
path: root/cmd/acmed/config.go
blob: 2e198490f0eaccd3288dc3100bf6064080d81f52 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main

import "github.com/BurntSushi/toml"

type Config struct {
	Defaults defaults
	Provider map[string]provider
	Account  map[string]account
	Hook     map[string]hook
	Desire   map[string]desire
}

type defaults struct {
	Gracetime string
	Listen    string
	Provider  string
	Account   string
	Basedir   string
}

type provider struct {
	Directory string
}

type account struct {
	Mail  string
	Phone string
	Key   string
}

type hook struct {
	CMD string
}

type desire struct {
	Provider string
	Account  string
	Altnames []string
	Key      string
	Cert     string
	Webroot  string
	Hooks    []string
}

func LoadConfig(fname string) (*Config, error) {
	c := &Config{}
	_, err := toml.DecodeFile(fname, c)
	return c, err
}