mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
nodeConfStore: create dir on start
This commit is contained in:
parent
1616766b4b
commit
6f5b0b04c2
2 changed files with 5 additions and 1 deletions
|
@ -30,6 +30,9 @@ type configGetter interface {
|
||||||
|
|
||||||
func (n *nodeConfStore) Init(a *app.App) (err error) {
|
func (n *nodeConfStore) Init(a *app.App) (err error) {
|
||||||
n.path = a.MustComponent("config").(configGetter).GetNodeConfStorePath()
|
n.path = a.MustComponent("config").(configGetter).GetNodeConfStorePath()
|
||||||
|
if e := os.Mkdir(n.path, 0755); e != nil && !os.IsExist(e) {
|
||||||
|
return e
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -74,7 +75,7 @@ type config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c config) GetNodeConfStorePath() string {
|
func (c config) GetNodeConfStorePath() string {
|
||||||
return c.path
|
return filepath.Join(c.path, "nodeconf")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c config) Init(a *app.App) (err error) {
|
func (c config) Init(a *app.App) (err error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue