summaryrefslogtreecommitdiff
path: root/system/search/search.go
diff options
context:
space:
mode:
authorMiguel Angel Ajo <majopela@redhat.com>2019-12-29 18:36:08 +0100
committerMiguel Angel Ajo <majopela@redhat.com>2019-12-29 23:42:46 +0100
commit90a2ff959a958e8f7654f577e88e942378b0a7c2 (patch)
tree934b6d72979f0edf26f3c661b6b059b6d1753e37 /system/search/search.go
parent45730ba5b4de56fed27f79f8c822bb59d41f7a38 (diff)
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
Diffstat (limited to 'system/search/search.go')
-rw-r--r--system/search/search.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/system/search/search.go b/system/search/search.go
index 8cd0fe6..d3bee6d 100644
--- a/system/search/search.go
+++ b/system/search/search.go
@@ -11,6 +11,8 @@ import (
"path/filepath"
"strings"
+ "github.com/ponzu-cms/ponzu/system/cfg"
+
"github.com/ponzu-cms/ponzu/system/item"
"github.com/blevesearch/bleve"
@@ -62,13 +64,7 @@ func MapIndex(typeName string) error {
idxName := typeName + ".index"
var idx bleve.Index
- // check if index exists, use it or create new one
- pwd, err := os.Getwd()
- if err != nil {
- return err
- }
-
- searchPath := filepath.Join(pwd, "search")
+ searchPath := cfg.SearchDir()
err = os.MkdirAll(searchPath, os.ModeDir|os.ModePerm)
if err != nil {