aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index d50c468..10bbbf0 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -44,6 +44,7 @@ func main() { //nolint:funlen
redisKey = "go-website"
pageTimeout = 15
genhash = false
+ mapcache = false
)
fl := flag.NewFlagSet("Website", flag.ExitOnError)
@@ -73,6 +74,8 @@ func main() { //nolint:funlen
"If set to false, do not cache the page index"))
logIfErr(envflag.Bool(fl, &genhash, "genhash", "INTERACTIVE_HASH_GEN",
"If set to true, interactively generate a password hash"))
+ logIfErr(envflag.Bool(fl, &mapcache, "mapcache", "USE_MAP_CACHE",
+ "Instead of utilizing redis, utilize a map internally for caching"))
_ = fl.Parse(os.Args[1:])
@@ -96,6 +99,10 @@ func main() { //nolint:funlen
app = &App{}
}
+ if mapcache {
+ app.mapCache = true
+ }
+
err = app.ReadAuth(authConfFn)
if err != nil {
logger.Println(err)
@@ -134,7 +141,7 @@ func main() { //nolint:funlen
os.Stderr.Write(b)
}
- page.Funcs["ClearRedis"] = app.ClearRedis
+ page.Funcs["ClearCache"] = app.ClearCache
srv := &http.Server{
Handler: app.Handler(),