package main import ( "crypto/rsa" "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 KeySize int } type provider struct { Directory string } type account struct { Mail string Phone string Key string KeySize int key *rsa.PrivateKey `toml:"-"` } type hook struct { CMD string } type desire struct { Provider string Account string Altnames []string Key string KeySize int Cert string Webroot string Hooks []string key *rsa.PrivateKey `toml:"-"` } func LoadConfig(fname string) (*Config, error) { c := &Config{} _, err := toml.DecodeFile(fname, c) return c, err } type Keychain interface { Path() string Size() int } func (d desire) Path() string { return d.Key } func (d desire) Size() int { return d.KeySize } func (a account) Path() string { return a.Key } func (a account) Size() int { return a.KeySize }