mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
default behavior for environment.LoadRoot was returning nil when it should have been returning an env_core.Root stub (#383)
This commit is contained in:
parent
349d251c84
commit
5f9c2c769f
@ -13,7 +13,7 @@ func LoadRoot() (env_core.Root, error) {
|
||||
} else if assert, err := env_v0_3.Assert(); assert && err == nil {
|
||||
return env_v0_3.Load()
|
||||
} else {
|
||||
return nil, err
|
||||
return env_v0_4.Default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,19 @@ type Root struct {
|
||||
env *env_core.Environment
|
||||
}
|
||||
|
||||
func Default() (*Root, error) {
|
||||
r := &Root{}
|
||||
root, err := rootDir()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.meta = &env_core.Metadata{
|
||||
V: V,
|
||||
RootPath: root,
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func Assert() (bool, error) {
|
||||
exists, err := rootExists()
|
||||
if err != nil {
|
||||
@ -55,14 +68,11 @@ func Load() (*Root, error) {
|
||||
}
|
||||
|
||||
} else {
|
||||
root, err := rootDir()
|
||||
root, err := Default()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.meta = &env_core.Metadata{
|
||||
V: V,
|
||||
RootPath: root,
|
||||
}
|
||||
r = root
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user