chore: replace map[string]interface{} by gin.H

This commit is contained in:
Vincent Bernat
2022-08-16 18:49:54 +02:00
parent c8fac33990
commit 985e678e42
9 changed files with 34 additions and 27 deletions

View File

@@ -16,6 +16,7 @@ import (
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"
"gopkg.in/yaml.v2"
@@ -34,7 +35,7 @@ type ConfigRelatedOptions struct {
// Parse parses the configuration file (if present) and the
// environment variables into the provided configuration.
func (c ConfigRelatedOptions) Parse(out io.Writer, component string, config interface{}) error {
var rawConfig map[string]interface{}
var rawConfig gin.H
if cfgFile := c.Path; cfgFile != "" {
if strings.HasPrefix(cfgFile, "http://") || strings.HasPrefix(cfgFile, "https://") {
u, err := url.Parse(cfgFile)
@@ -114,7 +115,7 @@ func (c ConfigRelatedOptions) Parse(out io.Writer, component string, config inte
newRawConfig[index] = rawConfig
rawConfig = newRawConfig
} else {
rawConfig = map[string]interface{}{
rawConfig = gin.H{
kk[i]: rawConfig,
}
}