summary refs log tree commit diff stats
path: root/cache.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-04 22:56:28 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-05 00:12:49 -0400
commit69217dd27196dd59c96bc405afe4bfd83ad17c00 (patch)
tree60183e14dd807bec5865610c1a58d4e432ed8221 /cache.go
parentdb1dc5d8c2d1557b085b63cb8c511f5a9864b38e (diff)
downloadgetwtxt-69217dd27196dd59c96bc405afe4bfd83ad17c00.tar.gz
cli flags for db path/type, assets dir. systemd unit file. makefile.
Diffstat (limited to 'cache.go')
-rw-r--r--cache.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cache.go b/cache.go
index 2db0fbb..882c4d8 100644
--- a/cache.go
+++ b/cache.go
@@ -67,12 +67,16 @@ func refreshCache() {
 // pulled back into memory from disk.
 func pingAssets() {
 
-	cssStat, err := os.Stat("assets/style.css")
+	confObj.Mu.RLock()
+	assetsDir := confObj.AssetsDir
+	confObj.Mu.RUnlock()
+
+	cssStat, err := os.Stat(assetsDir + "/style.css")
 	if err != nil {
 		log.Printf("%v\n", err.Error())
 	}
 
-	indexStat, err := os.Stat("assets/tmpl/index.html")
+	indexStat, err := os.Stat(assetsDir + "/tmpl/index.html")
 	if err != nil {
 		log.Printf("%v\n", err.Error())
 	}
@@ -99,7 +103,7 @@ func pingAssets() {
 
 	if !cssMod.Equal(cssStat.ModTime()) {
 
-		css, err := ioutil.ReadFile("assets/style.css")
+		css, err := ioutil.ReadFile(assetsDir + "/style.css")
 		if err != nil {
 			log.Printf("%v\n", err.Error())
 		}