Move persistence stuff to own package
This commit is contained in:
parent
742fb2be58
commit
72f5a67989
6
main.go
6
main.go
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
"git.hamburg.ccc.de/ccchh/spaceapid/config"
|
||||
"git.hamburg.ccc.de/ccchh/spaceapid/handlers"
|
||||
"git.hamburg.ccc.de/ccchh/spaceapid/persistence"
|
||||
"git.hamburg.ccc.de/ccchh/spaceapid/types"
|
||||
"git.hamburg.ccc.de/ccchh/spaceapid/util"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -39,7 +39,7 @@ func main() {
|
|||
conf := config.ParseConfiguration()
|
||||
|
||||
// Merge old state if present
|
||||
util.MergeOldState(&conf.Response)
|
||||
persistence.MergeOldState(&conf.Response)
|
||||
|
||||
// Register signal handler
|
||||
sc := make(chan os.Signal, 1)
|
||||
|
@ -47,7 +47,7 @@ func main() {
|
|||
go func(resp *types.SpaceAPIResponseV14) {
|
||||
<-sc
|
||||
log.Println("Saving state and shutting down...")
|
||||
util.SaveCurrentState(*resp)
|
||||
persistence.SaveCurrentState(*resp)
|
||||
os.Exit(0)
|
||||
}(&conf.Response)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package util
|
||||
package persistence
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -1,6 +1,6 @@
|
|||
//go:build !linux
|
||||
|
||||
package util
|
||||
package persistence
|
||||
|
||||
const (
|
||||
persistentStateDir = "./"
|
|
@ -1,4 +1,4 @@
|
|||
package util
|
||||
package persistence
|
||||
|
||||
const (
|
||||
persistentStateDir = "/var/lib/spaceapid/"
|
Loading…
Reference in a new issue