diff options
Diffstat (limited to 'internal/rpc/client.go')
-rw-r--r-- | internal/rpc/client.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/internal/rpc/client.go b/internal/rpc/client.go index 26d60d24..ba739d87 100644 --- a/internal/rpc/client.go +++ b/internal/rpc/client.go @@ -33,9 +33,6 @@ func NewClient(cfg string, flags []string) (*rpc.Client, error) { return nil, err } - // automatically inject ENV variables using ${ENV} pattern - expandEnvViper(v) - // override config Flags if len(flags) > 0 { for _, f := range flags { @@ -48,6 +45,20 @@ func NewClient(cfg string, flags []string) (*rpc.Client, error) { } } + ver := v.Get(versionKey) + if ver == nil { + return nil, fmt.Errorf("rr configuration file should contain a version e.g: version: 3") + } + + if _, ok := ver.(string); !ok { + return nil, fmt.Errorf("version should be a string: `version: \"3\"`, actual type is: %T", ver) + } + + err = handleInclude(ver.(string), v) + if err != nil { + return nil, fmt.Errorf("failed to handle includes: %w", err) + } + // rpc.listen might be set by the -o flags or env variable if !v.IsSet(rpcPlugin.PluginName) { return nil, errors.New("rpc service not specified in the configuration. Tip: add\n rpc:\n\r listen: rr_rpc_address") |