summaryrefslogtreecommitdiff
path: root/system/tls/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'system/tls/init.go')
-rw-r--r--system/tls/init.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/system/tls/init.go b/system/tls/init.go
index 5ffaf33..80e1ef3 100644
--- a/system/tls/init.go
+++ b/system/tls/init.go
@@ -19,7 +19,7 @@ var m autocert.Manager
func setup() {
pwd, err := os.Getwd()
if err != nil {
- log.Fatalln("Couldn't find working directory to locate or save certs.")
+ log.Fatalln("Couldn't find working directory to locate or save certificates.")
}
cache := autocert.DirCache(filepath.Join(pwd, "system", "tls", "certs"))
@@ -30,13 +30,24 @@ func setup() {
}
}
+ // get host/domain and email from Config to use for TLS request to Let's encryption.
+ // we will fail fatally if either are not found since Let's Encrypt will rate-limit
+ // and sending incomplete requests is wasteful and guarenteed to fail its check
host, err := db.Config("domain")
if err != nil {
+ log.Fatalln("Error identifying host/domain during TLS set-up.", err)
+ }
+
+ if host == nil {
log.Fatalln("No 'domain' field set in Configuration. Please add a domain before attempting to make certificates.")
}
email, err := db.Config("admin_email")
if err != nil {
+ log.Fatalln("Error identifying admin email during TLS set-up.", err)
+ }
+
+ if email == nil {
log.Fatalln("No 'admin_email' field set in Configuration. Please add an admin email before attempting to make certificates.")
}