mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 17:50:12 +00:00
fix(agentcompat): root scenario config reads
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
@@ -4,12 +4,18 @@ package scenario
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
func ReadConfigFile(path string) (AgentConfig, error) {
|
||||
data, err := os.ReadFile(path)
|
||||
root, err := os.OpenRoot(filepath.Dir(path))
|
||||
if err != nil {
|
||||
return AgentConfig{}, err
|
||||
}
|
||||
defer root.Close()
|
||||
data, err := root.ReadFile(filepath.Base(path))
|
||||
if err != nil {
|
||||
return AgentConfig{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user