diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-04 22:56:28 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-05 00:12:49 -0400 |
commit | 69217dd27196dd59c96bc405afe4bfd83ad17c00 (patch) | |
tree | 60183e14dd807bec5865610c1a58d4e432ed8221 /cache.go | |
parent | db1dc5d8c2d1557b085b63cb8c511f5a9864b38e (diff) | |
download | getwtxt-69217dd27196dd59c96bc405afe4bfd83ad17c00.tar.gz |
cli flags for db path/type, assets dir. systemd unit file. makefile.
Diffstat (limited to 'cache.go')
-rw-r--r-- | cache.go | 10 |
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()) } |