From 90a2ff959a958e8f7654f577e88e942378b0a7c2 Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Sun, 29 Dec 2019 18:36:08 +0100 Subject: Allow data directories outside pwd Running ponzu-cms inside a docker container, and maintaining data files in a volume (or several) was not possible with the previous directory schema without copying files or binaries to the volume. This commit adds several environment variables to allow the administrator to specify paths for directories while retaining backwards compatibility. - PONZU_DATA_DIR : is the directory where all the data and other directories will be stored, still the other directories can be controlled by the other env variables. - PONZU_TLS_DIR : is the directory to store devcerts and autocerts - PONZU_ADMINSTATIC_DIR : directory where the admin static files are served from. - PONZU_UPLOAD_DIR: upload files directory - PONZU_SEARCH_DIR: index directory for searches --- system/tls/enabledev.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'system/tls/enabledev.go') diff --git a/system/tls/enabledev.go b/system/tls/enabledev.go index 3550fc0..03bce42 100644 --- a/system/tls/enabledev.go +++ b/system/tls/enabledev.go @@ -3,8 +3,9 @@ package tls import ( "log" "net/http" - "os" "path/filepath" + + "github.com/ponzu-cms/ponzu/system/cfg" ) // EnableDev generates self-signed SSL certificates to use HTTPS & HTTP/2 while @@ -15,13 +16,7 @@ import ( func EnableDev() { setupDev() - pwd, err := os.Getwd() - if err != nil { - log.Fatalln("Couldn't find working directory to activate dev certificates:", err) - } - - vendorPath := filepath.Join(pwd, "cmd", "ponzu", "vendor", "github.com", "ponzu-cms", "ponzu", "system", "tls") - + vendorPath := cfg.TlsDir() cert := filepath.Join(vendorPath, "devcerts", "cert.pem") key := filepath.Join(vendorPath, "devcerts", "key.pem") -- cgit v1.2.3