Make statePath a variable (temporary)

This is a temporary fix until the state path is made
configurable.
This commit is contained in:
kaiyou 2020-05-13 10:45:16 +02:00 committed by Leo Antunes
parent 66b0321bf7
commit 49c0d7f802
2 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,8 @@ type state struct {
Nodes []common.Node Nodes []common.Node
} }
const statePath = "/var/lib/wesher/state.json" // TODO: this should be replaced by a configurable path later
var statePath = "/var/lib/wesher/state.json"
func (s *state) save() error { func (s *state) save() error {
if err := os.MkdirAll(path.Dir(statePath), 0700); err != nil { if err := os.MkdirAll(path.Dir(statePath), 0700); err != nil {

View File

@ -9,6 +9,7 @@ import (
) )
func Test_state_save_soad(t *testing.T) { func Test_state_save_soad(t *testing.T) {
statePath = "/tmp/wesher.json"
key := "abcdefghijklmnopqrstuvwxyzABCDEF" key := "abcdefghijklmnopqrstuvwxyzABCDEF"
node := common.Node{ node := common.Node{
Name: "node", Name: "node",