From 9298d82521aae11ff0bd3a57d96b0153a10be230 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Tue, 10 Sep 2024 11:50:58 -0500 Subject: [PATCH] Add ability to load a config from a given path (#145) --- pkg/config/load.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/config/load.go b/pkg/config/load.go index 8998291..bc453a4 100644 --- a/pkg/config/load.go +++ b/pkg/config/load.go @@ -26,6 +26,12 @@ func GetChiaConfig() (*ChiaConfig, error) { return nil, fmt.Errorf("chia config file not found at %s. Ensure CHIA_ROOT is set to the correct chia root", configPath) } + return LoadConfigAtRoot(configPath, rootPath) +} + +// LoadConfigAtRoot loads the given configPath into a ChiaConfig +// chiaRoot is required to fill the database paths in the config +func LoadConfigAtRoot(configPath, rootPath string) (*ChiaConfig, error) { configBytes, err := os.ReadFile(configPath) if err != nil { return nil, err