cmd/app: common configuration file
Test / ShareFS (push) Failing after 1m37s
Test / Create distribution (push) Failing after 1m38s
Test / Sandbox (push) Failing after 1m48s
Test / Sandbox (race detector) (push) Failing after 1m53s
Test / Hakurei (push) Failing after 1m57s
Test / Hakurei (race detector) (push) Failing after 2m5s
Test / Flake checks (push) Has been skipped
Test / ShareFS (push) Failing after 1m37s
Test / Create distribution (push) Failing after 1m38s
Test / Sandbox (push) Failing after 1m48s
Test / Sandbox (race detector) (push) Failing after 1m53s
Test / Hakurei (push) Failing after 1m57s
Test / Hakurei (race detector) (push) Failing after 2m5s
Test / Flake checks (push) Has been skipped
Generally useful for shared storage and environment. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
+19
-1
@@ -134,14 +134,32 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var config *hst.Config
|
var config *hst.Config
|
||||||
|
var r io.Reader
|
||||||
f, err := os.Open(base.Append("app", args[0]).String())
|
f, err := os.Open(base.Append("app", args[0]).String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
config, err = parse(args[0], base, f)
|
r = f
|
||||||
|
|
||||||
|
var common *os.File
|
||||||
|
if common, err = os.Open(base.Append("common").String()); err != nil {
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
_ = f.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = io.MultiReader(f, common)
|
||||||
|
}
|
||||||
|
|
||||||
|
config, err = parse(args[0], base, r)
|
||||||
if closeErr := f.Close(); err == nil {
|
if closeErr := f.Close(); err == nil {
|
||||||
err = closeErr
|
err = closeErr
|
||||||
}
|
}
|
||||||
|
if common != nil {
|
||||||
|
if closeErr := common.Close(); err == nil {
|
||||||
|
err = closeErr
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user