mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
Revert "cmd: accept an !include tag for YAML files"
This reverts commit b8698bc060. This
change is not complete, it is missing adaptations in docker-compose.yml.
This commit is contained in:
@@ -6,11 +6,11 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -19,8 +19,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
|
||||
"akvorado/common/helpers/yaml"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"akvorado/common/helpers"
|
||||
)
|
||||
@@ -67,15 +66,11 @@ func (c ConfigRelatedOptions) Parse(out io.Writer, component string, config inte
|
||||
return fmt.Errorf("unable to parse YAML configuration file: %w", err)
|
||||
}
|
||||
} else {
|
||||
cfgFile, err := filepath.EvalSymlinks(cfgFile)
|
||||
input, err := ioutil.ReadFile(cfgFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot follow symlink: %w", err)
|
||||
return fmt.Errorf("unable to read configuration file: %w", err)
|
||||
}
|
||||
dirname, filename := filepath.Split(cfgFile)
|
||||
if dirname == "" {
|
||||
dirname = "."
|
||||
}
|
||||
if err := yaml.UnmarshalWithInclude(os.DirFS(dirname), filename, &rawConfig); err != nil {
|
||||
if err := yaml.Unmarshal(input, &rawConfig); err != nil {
|
||||
return fmt.Errorf("unable to parse YAML configuration file: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user