mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
DISK_CACHE_PATH as an environment variable.
This commit is contained in:
4
cache.go
4
cache.go
@@ -17,9 +17,9 @@ type Cache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) initialize() func() {
|
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 {
|
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
|
c.DB = db
|
||||||
|
|
||||||
|
|||||||
1
main.go
1
main.go
@@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
Port string `envconfig:"PORT" default:"2999"`
|
Port string `envconfig:"PORT" default:"2999"`
|
||||||
|
DiskCachePath string `envconfig:"DISK_CACHE_PATH" default:"/tmp/njump-cache"`
|
||||||
CanonicalHost string `envconfig:"DOMAIN" default:"njump.me"`
|
CanonicalHost string `envconfig:"DOMAIN" default:"njump.me"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user