diff --git a/nodeconf/nodeconfstore/nodeconfstore.go b/nodeconf/nodeconfstore/nodeconfstore.go index 75a16fa2..2033ffca 100644 --- a/nodeconf/nodeconfstore/nodeconfstore.go +++ b/nodeconf/nodeconfstore/nodeconfstore.go @@ -30,6 +30,9 @@ type configGetter interface { func (n *nodeConfStore) Init(a *app.App) (err error) { n.path = a.MustComponent("config").(configGetter).GetNodeConfStorePath() + if e := os.Mkdir(n.path, 0755); e != nil && !os.IsExist(e) { + return e + } return } diff --git a/nodeconf/nodeconfstore/nodeconfstore_test.go b/nodeconf/nodeconfstore/nodeconfstore_test.go index a525d1a7..cb4d5202 100644 --- a/nodeconf/nodeconfstore/nodeconfstore_test.go +++ b/nodeconf/nodeconfstore/nodeconfstore_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "os" + "path/filepath" "testing" "time" ) @@ -74,7 +75,7 @@ type config struct { } func (c config) GetNodeConfStorePath() string { - return c.path + return filepath.Join(c.path, "nodeconf") } func (c config) Init(a *app.App) (err error) {