repo: check for config in exists
This commit is contained in:
parent
81d7c30fac
commit
4fa9e45eb7
@ -31,6 +31,9 @@ var runCmd = &cli.Command{
|
|||||||
ctx := lcli.ReqContext(cctx)
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
|
||||||
v, err := nodeApi.Version(ctx)
|
v, err := nodeApi.Version(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
r, err := repo.NewFS(cctx.String(FlagStorageRepo))
|
r, err := repo.NewFS(cctx.String(FlagStorageRepo))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -59,7 +59,7 @@ func NewFS(path string) (*FsRepo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fsr *FsRepo) Exists() (bool, error) {
|
func (fsr *FsRepo) Exists() (bool, error) {
|
||||||
_, err := os.Stat(fsr.path)
|
_, err := os.Stat(filepath.Join(fsr.path, fsConfig))
|
||||||
notexist := os.IsNotExist(err)
|
notexist := os.IsNotExist(err)
|
||||||
if notexist {
|
if notexist {
|
||||||
err = nil
|
err = nil
|
||||||
@ -79,6 +79,14 @@ func (fsr *FsRepo) Init() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
c, err := os.Create(filepath.Join(fsr.path, fsConfig))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := c.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return fsr.initKeystore()
|
return fsr.initKeystore()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user