From 681e0e0a4d80adbc28ac7cf7c49aab4c7c0bfc41 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Jul 2020 11:40:40 +0300 Subject: [PATCH] config: allow to specify config path directly It costs us nothing and makes API much more flexible. --- pkg/config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index 68b0bc8c9..390704893 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -31,6 +31,11 @@ func (c Config) GenerateUserAgent() string { // path for the given netMode. func Load(path string, netMode netmode.Magic) (Config, error) { configPath := fmt.Sprintf("%s/protocol.%s.yml", path, netMode) + return LoadFile(configPath) +} + +// LoadFile loads config from the provided path. +func LoadFile(configPath string) (Config, error) { if _, err := os.Stat(configPath); os.IsNotExist(err) { return Config{}, errors.Wrap(err, "Unable to load config") }