diff --git a/cache.go b/cache.go index 4e80ab1..a233afd 100644 --- a/cache.go +++ b/cache.go @@ -17,9 +17,9 @@ type Cache struct { } func (c *Cache) initialize() func() { - db, err := badger.Open(badger.DefaultOptions("/tmp/njump-cache")) + db, err := badger.Open(badger.DefaultOptions(s.DiskCachePath)) if err != nil { - log.Fatal().Err(err).Msg("failed to open badger at /tmp/njump-cache") + log.Fatal().Err(err).Str("path", s.DiskCachePath).Msg("failed to open badger") } c.DB = db diff --git a/main.go b/main.go index 0687df6..7cd393a 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ import ( type Settings struct { Port string `envconfig:"PORT" default:"2999"` + DiskCachePath string `envconfig:"DISK_CACHE_PATH" default:"/tmp/njump-cache"` CanonicalHost string `envconfig:"DOMAIN" default:"njump.me"` }