mirror of
https://github.com/openziti/zrok.git
synced 2025-06-21 10:17:51 +02:00
if there is not an identities path, just skip listing identities (#136)
This commit is contained in:
parent
2ec8a07d4b
commit
03172244cc
@ -104,15 +104,23 @@ func Obliterate() error {
|
||||
}
|
||||
|
||||
func listIdentities() (map[string]struct{}, error) {
|
||||
ids := make(map[string]struct{})
|
||||
|
||||
idd, err := identitiesDir()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error getting zrokdir identities path")
|
||||
}
|
||||
_, err = os.Stat(idd)
|
||||
if os.IsNotExist(err) {
|
||||
return ids, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error stat-ing zrokdir identities root '%v'", idd)
|
||||
}
|
||||
des, err := os.ReadDir(idd)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error listing zrokdir identities from '%v'", idd)
|
||||
}
|
||||
ids := make(map[string]struct{})
|
||||
for _, de := range des {
|
||||
if strings.HasSuffix(de.Name(), ".json") && !de.IsDir() {
|
||||
name := strings.TrimSuffix(de.Name(), ".json")
|
||||
|
Loading…
x
Reference in New Issue
Block a user