summaryrefslogtreecommitdiff
path: root/system/tls/enable.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2020-01-01 17:14:32 -0700
committerGitHub <noreply@github.com>2020-01-01 17:14:32 -0700
commit9bc41b703131aa42ca64265ab6fdeadc37841e66 (patch)
tree138e6b7d6f8bd5c879eff61ce85df95506546003 /system/tls/enable.go
parent45730ba5b4de56fed27f79f8c822bb59d41f7a38 (diff)
parent6ee81caea4649d3fc3bb6b5bde0628cb91c8e6f5 (diff)
Merge pull request #333 from mangelajo/env-vars-for-dirs
Allow data directories outside pwd
Diffstat (limited to 'system/tls/enable.go')
-rw-r--r--system/tls/enable.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/system/tls/enable.go b/system/tls/enable.go
index 9fc95f9..12d63bc 100644
--- a/system/tls/enable.go
+++ b/system/tls/enable.go
@@ -13,18 +13,15 @@ import (
"time"
"github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/cfg"
"golang.org/x/crypto/acme/autocert"
)
// newManager attempts to locate or create the cert cache directory and the
// certs for TLS encryption and returns an autocert.Manager
func newManager() autocert.Manager {
- pwd, err := os.Getwd()
- if err != nil {
- log.Fatalln("Couldn't find working directory to locate or save certificates.")
- }
- cache := autocert.DirCache(filepath.Join(pwd, "system", "tls", "certs"))
+ cache := autocert.DirCache(filepath.Join(cfg.TlsDir(), "certs"))
if _, err := os.Stat(string(cache)); os.IsNotExist(err) {
err := os.MkdirAll(string(cache), os.ModePerm|os.ModeDir)
if err != nil {