aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acme.toml7
-rw-r--r--cmd/acme/config.go19
2 files changed, 14 insertions, 12 deletions
diff --git a/acme.toml b/acme.toml
index eb801ce..05e52ce 100644
--- a/acme.toml
+++ b/acme.toml
@@ -1,18 +1,17 @@
-[[account]]
mail = "another@example.com"
key = "/etc/acme.key"
provider = "https://acme-staging.api.letsencrypt.org/directory"
-[[account.want]]
+[[want]]
domains = [ "www.example.com", "example.com" ]
cert = "/etc/certs/www_example_com.pem"
key = "/etc/private/www_example_com.key"
# webroot = /var/www/htdocs
-[[account.want]]
+[[want]]
domains = [ "www.example.net", "example.net" ]
cert = "/etc/certs/www_example_net.pem"
key = "/etc/private/www_example_net.key"
-[[account.hook]]
+[hook]
cmd = "sudo service nginx reload"
diff --git a/cmd/acme/config.go b/cmd/acme/config.go
index 24d7820..b880c11 100644
--- a/cmd/acme/config.go
+++ b/cmd/acme/config.go
@@ -6,16 +6,12 @@ import (
"github.com/BurntSushi/toml"
)
-type Config struct {
- Account Account
- Want []Want
- Hook []Hook
-}
-
type Account struct {
Mail string
Key string
Provider string
+ Want []Want
+ Hook Hook
}
type Want struct {
@@ -28,11 +24,18 @@ type Hook struct {
CMD string
}
-func ReadConfig(fname string) Config {
- var c Config
+func ReadConfig(fname string) Account {
+ var c Account
_, err := toml.DecodeFile(fname, &c)
if err != nil {
log.Fatal(err)
}
return c
}
+
+/*
+func main() {
+ a := ReadConfig("acme.toml")
+ log.Printf("%+v\n", a)
+}
+*/