From 6717d03016cf607b006e7321954926f23e89c8dc Mon Sep 17 00:00:00 2001 From: Reece Williams <31943163+Reecepbcups@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:33:33 -0500 Subject: [PATCH] fix: do not require a directory for remote urls (#1283) Co-authored-by: Justin Tieri <37750742+jtieri@users.noreply.github.com> --- local-interchain/cmd/local-ic/start_chain.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/local-interchain/cmd/local-ic/start_chain.go b/local-interchain/cmd/local-ic/start_chain.go index 075deb110..dea17c8fd 100644 --- a/local-interchain/cmd/local-ic/start_chain.go +++ b/local-interchain/cmd/local-ic/start_chain.go @@ -36,7 +36,13 @@ local-ic start https://pastebin.com/raw/Ummk4DTM Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { configPath := args[0] - parentDir := GetDirectory() + isURL := strings.HasPrefix(configPath, "http") + + var ( + parentDir string + config *types.Config + err error + ) if path.IsAbs(configPath) { dir, err := filepath.Abs(configPath) @@ -48,10 +54,7 @@ local-ic start https://pastebin.com/raw/Ummk4DTM configPath = filepath.Base(configPath) } - var config *types.Config - var err error - - if strings.HasPrefix(configPath, "http") { + if isURL { config, err = interchain.LoadConfigFromURL(configPath) if err != nil { panic(err) @@ -60,6 +63,8 @@ local-ic start https://pastebin.com/raw/Ummk4DTM // last part of the URL to be the test name configPath = configPath[strings.LastIndex(configPath, "/")+1:] } else { + parentDir = GetDirectory() + configPath, err = GetConfigWithExtension(parentDir, configPath) if err != nil { panic(err)