mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Fix cue loader to use absolute path (#54257)
This commit is contained in:
parent
20d0aa9904
commit
b9be2815d3
@ -9,9 +9,10 @@ import (
|
|||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
"cuelang.org/go/cue/load"
|
"cuelang.org/go/cue/load"
|
||||||
"github.com/grafana/grafana/pkg/cuectx"
|
|
||||||
"github.com/grafana/thema/kernel"
|
"github.com/grafana/thema/kernel"
|
||||||
tload "github.com/grafana/thema/load"
|
tload "github.com/grafana/thema/load"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/cuectx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Embed for all framework-related CUE files in this directory
|
// Embed for all framework-related CUE files in this directory
|
||||||
@ -54,13 +55,22 @@ func doLoadFrameworkCUE(ctx *cue.Context) (v cue.Value, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
over := make(map[string]load.Source)
|
over := make(map[string]load.Source)
|
||||||
err = tload.ToOverlay(prefix, m, over)
|
|
||||||
|
absolutePath := prefix
|
||||||
|
if !filepath.IsAbs(absolutePath) {
|
||||||
|
absolutePath, err = filepath.Abs(absolutePath)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tload.ToOverlay(absolutePath, m, over)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
bi := load.Instances(nil, &load.Config{
|
bi := load.Instances(nil, &load.Config{
|
||||||
Dir: prefix,
|
Dir: absolutePath,
|
||||||
Package: "coremodel",
|
Package: "coremodel",
|
||||||
Overlay: over,
|
Overlay: over,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user