From dda49867df77d697f0f1dc624df1fc3a9e965766 Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Mon, 11 Apr 2022 18:24:15 -0400 Subject: [PATCH 01/11] Issue 18 and 55 profile support and profile flag --- cmd/configure.go | 103 ++++++++++++++++++++++++++++++++++ cmd/root.go | 40 ++++--------- config/config.go | 2 +- external/profiles/profiles.go | 6 +- 4 files changed, 119 insertions(+), 32 deletions(-) create mode 100644 cmd/configure.go diff --git a/cmd/configure.go b/cmd/configure.go new file mode 100644 index 00000000..b7ea6d60 --- /dev/null +++ b/cmd/configure.go @@ -0,0 +1,103 @@ +package cmd + +import ( + "bufio" + "github.com/elasticpath/epcc-cli/config" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "gopkg.in/ini.v1" + "os" + "path/filepath" + "strings" +) + +var configure = &cobra.Command{ + Use: "configure", + Short: "Creates a profile by prompting for input over the command line.", + Long: "Will first prompt for a name then a series of variable specific for the user being created", + Run: func(cmd *cobra.Command, args []string) { + + configPath := GetProfilePath() + cfg, err := ini.Load(configPath) + if err != nil{ + log.Errorf("error loading to file " +configPath) + os.Exit(1) + } + newProfile := config.Env{} + reader := bufio.NewReader(os.Stdin) + println("Create new Profile") + print("Profile Name:") + text := readInput(reader) + print("Base URL:") + newProfile.EPCC_API_BASE_URL = readInput(reader) + print("Client ID:") + newProfile.EPCC_CLIENT_ID = readInput(reader) + print("Client Secret:") + newProfile.EPCC_CLIENT_SECRET = readInput(reader) + print("Beta Features:") + newProfile.EPCC_BETA_API_FEATURES= readInput(reader) + + section, err :=cfg.NewSection(text) + section.ReflectFrom(&newProfile) + cfg.SaveTo(configPath) + if err!= nil{ + log.Errorf("error writing to file " +configPath) + os.Exit(1) + } + config.Envs = &newProfile + config.Profile = text + + }, +} +func getProfileDirectory() string{ + home, err := os.UserHomeDir() + if err != nil { + log.Errorf("could not get home directory") + os.Exit(1) + } + configDir := home +"/.epcc/profiles_data" + configDir = filepath.FromSlash(configDir) + //built in check if dir exists + if err = os.MkdirAll(configDir, 0700); err != nil{ + log.Errorf("could not make directory") + } + + return configDir +} +func GetProfilePath() string{ + configPath := getProfileDirectory() + configPath = filepath.FromSlash(configPath + "/config") + if _, err := os.Stat(configPath); err != nil { + log.Trace("could not find file at " + configPath) + file , err := os.Create(configPath) + defer file.Close() + if err != nil{ + log.Errorf("could not create file at " + configPath) + } + log.Trace("creating config file at " + configPath) + } + + return configPath +} + + +func readInput(reader *bufio.Reader) string{ +response, _ := reader.ReadString('\n') +return strings.TrimSuffix(response, "\n") +} +func GetProfile(name string) *config.Env{ + result := config.Env{} + configPath := GetProfilePath() + cfg, err := ini.Load(configPath) + if err != nil{ + log.Errorf("could not load file at " + configPath) + os.Exit(1) + } + if !cfg.HasSection(name){ + log.Errorf("could not find profile in file") + os.Exit(1) + } + cfg.Section(name).MapTo(&result) + return &result + +} diff --git a/cmd/root.go b/cmd/root.go index cec9c5c7..c46b7006 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,9 +10,7 @@ import ( "github.com/caarlos0/env/v6" "github.com/elasticpath/epcc-cli/external/json" - homedir "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" - "github.com/spf13/viper" ) func init() { @@ -33,6 +31,7 @@ func init() { logs, resourceListCommand, aliasesCmd, + configure, ) logs.AddCommand(logsList, logsShow, logsClear) @@ -45,7 +44,7 @@ func init() { "sets logging level; can be 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'panic'") rootCmd.PersistentFlags().BoolVarP(&json.MonochromeOutput, "monochrome-output", "M", false, "By default, epcc will output using colors if the terminal supports this. Use this option to disable it.") rootCmd.PersistentFlags().StringSliceVarP(&globals.RawHeaders, "header", "H", []string{}, "Extra headers and values to include in the request when sending HTTP to a server. You may specify any number of extra headers.") - + rootCmd.PersistentFlags().StringVarP(&config.Profile, "profile", "P", "", "overrides the current EPCC_PROFILE var to run the command with the chosen profile.") aliasesCmd.AddCommand(aliasListCmd, aliasClearCmd) } @@ -79,31 +78,16 @@ func Execute() { } func initConfig() { - // Don't forget to read config either from cfgFile or from home directory! - cfgFile := "" - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := homedir.Dir() - if err != nil { - log.Errorf("Error %s", err) - os.Exit(1) + if config.Profile == "" { + envProfile, present := os.LookupEnv("EPCC_PROFILE") + if !present { + //creates configfile is this is users first time running app + GetProfilePath() + log.Println("profile tag and EPCC_PROFILE variable are absent") + return } - - // Search config in home directory with name ".cobra" (without extension). - viper.AddConfigPath(home) - viper.SetConfigName(".epcc") + config.Profile = envProfile } + config.Envs = GetProfile(config.Profile) - if err := viper.ReadInConfig(); err != nil { - if _, ok := err.(viper.ConfigFileNotFoundError); ok { - // Config file not found; ignore error if desired - } else { - log.Errorf("Can't read config %s", err) - os.Exit(1) - } - - } -} +} \ No newline at end of file diff --git a/config/config.go b/config/config.go index 7deb8d2f..6c591d2c 100644 --- a/config/config.go +++ b/config/config.go @@ -5,7 +5,7 @@ type Env struct { EPCC_CLIENT_ID string `env:"EPCC_CLIENT_ID"` EPCC_CLIENT_SECRET string `env:"EPCC_CLIENT_SECRET"` EPCC_BETA_API_FEATURES string `env:"EPCC_BETA_API_FEATURES"` - EPCC_PROFILE string `env:"EPCC_PROFILE"` } var Envs = &Env{} +var Profile string diff --git a/external/profiles/profiles.go b/external/profiles/profiles.go index 19c75a6a..8a37967f 100644 --- a/external/profiles/profiles.go +++ b/external/profiles/profiles.go @@ -11,9 +11,9 @@ import ( ) func GetProfileName() string { - if config.Envs.EPCC_PROFILE != "" { - log.Tracef("Using EPCC_PROFILE value for profile %s", config.Envs.EPCC_PROFILE) - return config.Envs.EPCC_PROFILE + if config.Profile != "" { + log.Tracef("Using EPCC_PROFILE value for profile %s", config.Profile) + return config.Profile } else { u, err := url.Parse(config.Envs.EPCC_API_BASE_URL) profileName := "" From 545da1486528d49df7ac084573704999584ce45f Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 09:59:00 -0400 Subject: [PATCH 02/11] issue18 ran formatter --- cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index c46b7006..168bcf95 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -90,4 +90,4 @@ func initConfig() { } config.Envs = GetProfile(config.Profile) -} \ No newline at end of file +} From fc59bacec4443af4df4426adaaa16305ac052134 Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 10:04:47 -0400 Subject: [PATCH 03/11] issue18 ran formatter again --- cmd/configure.go | 86 +++++++++++++++++++++++++----------------------- cmd/root.go | 1 - 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/cmd/configure.go b/cmd/configure.go index b7ea6d60..6f17e940 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -17,61 +17,63 @@ var configure = &cobra.Command{ Long: "Will first prompt for a name then a series of variable specific for the user being created", Run: func(cmd *cobra.Command, args []string) { - configPath := GetProfilePath() - cfg, err := ini.Load(configPath) - if err != nil{ - log.Errorf("error loading to file " +configPath) - os.Exit(1) - } - newProfile := config.Env{} - reader := bufio.NewReader(os.Stdin) - println("Create new Profile") - print("Profile Name:") - text := readInput(reader) - print("Base URL:") - newProfile.EPCC_API_BASE_URL = readInput(reader) - print("Client ID:") - newProfile.EPCC_CLIENT_ID = readInput(reader) - print("Client Secret:") - newProfile.EPCC_CLIENT_SECRET = readInput(reader) - print("Beta Features:") - newProfile.EPCC_BETA_API_FEATURES= readInput(reader) + configPath := GetProfilePath() + cfg, err := ini.Load(configPath) + if err != nil { + log.Errorf("error loading to file " + configPath) + os.Exit(1) + } + newProfile := config.Env{} + reader := bufio.NewReader(os.Stdin) + println("Create new Profile") + print("Profile Name:") + text := readInput(reader) + print("Base URL:") + newProfile.EPCC_API_BASE_URL = readInput(reader) + print("Client ID:") + newProfile.EPCC_CLIENT_ID = readInput(reader) + print("Client Secret:") + newProfile.EPCC_CLIENT_SECRET = readInput(reader) + print("Beta Features:") + newProfile.EPCC_BETA_API_FEATURES = readInput(reader) - section, err :=cfg.NewSection(text) - section.ReflectFrom(&newProfile) - cfg.SaveTo(configPath) - if err!= nil{ - log.Errorf("error writing to file " +configPath) - os.Exit(1) - } - config.Envs = &newProfile - config.Profile = text + section, err := cfg.NewSection(text) + section.ReflectFrom(&newProfile) + cfg.SaveTo(configPath) + if err != nil { + log.Errorf("error writing to file " + configPath) + os.Exit(1) + } + config.Envs = &newProfile + config.Profile = text }, } -func getProfileDirectory() string{ + +func getProfileDirectory() string { home, err := os.UserHomeDir() if err != nil { log.Errorf("could not get home directory") os.Exit(1) } - configDir := home +"/.epcc/profiles_data" + configDir := home + "/.epcc/profiles_data" configDir = filepath.FromSlash(configDir) //built in check if dir exists - if err = os.MkdirAll(configDir, 0700); err != nil{ + if err = os.MkdirAll(configDir, 0700); err != nil { log.Errorf("could not make directory") } return configDir } -func GetProfilePath() string{ + +func GetProfilePath() string { configPath := getProfileDirectory() configPath = filepath.FromSlash(configPath + "/config") - if _, err := os.Stat(configPath); err != nil { + if _, err := os.Stat(configPath); err != nil { log.Trace("could not find file at " + configPath) - file , err := os.Create(configPath) + file, err := os.Create(configPath) defer file.Close() - if err != nil{ + if err != nil { log.Errorf("could not create file at " + configPath) } log.Trace("creating config file at " + configPath) @@ -80,20 +82,20 @@ func GetProfilePath() string{ return configPath } - -func readInput(reader *bufio.Reader) string{ -response, _ := reader.ReadString('\n') -return strings.TrimSuffix(response, "\n") +func readInput(reader *bufio.Reader) string { + response, _ := reader.ReadString('\n') + return strings.TrimSuffix(response, "\n") } -func GetProfile(name string) *config.Env{ + +func GetProfile(name string) *config.Env { result := config.Env{} configPath := GetProfilePath() cfg, err := ini.Load(configPath) - if err != nil{ + if err != nil { log.Errorf("could not load file at " + configPath) os.Exit(1) } - if !cfg.HasSection(name){ + if !cfg.HasSection(name) { log.Errorf("could not find profile in file") os.Exit(1) } diff --git a/cmd/root.go b/cmd/root.go index 1d003693..06be8305 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -34,7 +34,6 @@ func init() { configure, login, logout, - ) logs.AddCommand(logsList, logsShow, logsClear) From c6e73a35dae6c0b736971c8a346444155ab6b8be Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 10:21:17 -0400 Subject: [PATCH 04/11] issue18 moved profile functions from configure to profiles --- cmd/configure.go | 52 +---------------------- cmd/root.go | 5 ++- external/profiles/profiles.go | 77 ++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 89 deletions(-) diff --git a/cmd/configure.go b/cmd/configure.go index 6f17e940..d0acc880 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -3,11 +3,11 @@ package cmd import ( "bufio" "github.com/elasticpath/epcc-cli/config" + "github.com/elasticpath/epcc-cli/external/profiles" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "gopkg.in/ini.v1" "os" - "path/filepath" "strings" ) @@ -17,7 +17,7 @@ var configure = &cobra.Command{ Long: "Will first prompt for a name then a series of variable specific for the user being created", Run: func(cmd *cobra.Command, args []string) { - configPath := GetProfilePath() + configPath := profiles.GetProfilePath() cfg, err := ini.Load(configPath) if err != nil { log.Errorf("error loading to file " + configPath) @@ -50,56 +50,8 @@ var configure = &cobra.Command{ }, } -func getProfileDirectory() string { - home, err := os.UserHomeDir() - if err != nil { - log.Errorf("could not get home directory") - os.Exit(1) - } - configDir := home + "/.epcc/profiles_data" - configDir = filepath.FromSlash(configDir) - //built in check if dir exists - if err = os.MkdirAll(configDir, 0700); err != nil { - log.Errorf("could not make directory") - } - - return configDir -} - -func GetProfilePath() string { - configPath := getProfileDirectory() - configPath = filepath.FromSlash(configPath + "/config") - if _, err := os.Stat(configPath); err != nil { - log.Trace("could not find file at " + configPath) - file, err := os.Create(configPath) - defer file.Close() - if err != nil { - log.Errorf("could not create file at " + configPath) - } - log.Trace("creating config file at " + configPath) - } - - return configPath -} - func readInput(reader *bufio.Reader) string { response, _ := reader.ReadString('\n') return strings.TrimSuffix(response, "\n") } -func GetProfile(name string) *config.Env { - result := config.Env{} - configPath := GetProfilePath() - cfg, err := ini.Load(configPath) - if err != nil { - log.Errorf("could not load file at " + configPath) - os.Exit(1) - } - if !cfg.HasSection(name) { - log.Errorf("could not find profile in file") - os.Exit(1) - } - cfg.Section(name).MapTo(&result) - return &result - -} diff --git a/cmd/root.go b/cmd/root.go index 06be8305..4dbca450 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -3,6 +3,7 @@ package cmd import ( "github.com/elasticpath/epcc-cli/config" "github.com/elasticpath/epcc-cli/external/logger" + "github.com/elasticpath/epcc-cli/external/profiles" "github.com/elasticpath/epcc-cli/globals" log "github.com/sirupsen/logrus" "github.com/thediveo/enumflag" @@ -84,12 +85,12 @@ func initConfig() { envProfile, present := os.LookupEnv("EPCC_PROFILE") if !present { //creates configfile is this is users first time running app - GetProfilePath() + profiles.GetProfilePath() log.Println("profile tag and EPCC_PROFILE variable are absent") return } config.Profile = envProfile } - config.Envs = GetProfile(config.Profile) + config.Envs = profiles.GetProfile(config.Profile) } diff --git a/external/profiles/profiles.go b/external/profiles/profiles.go index 8a37967f..76c535a5 100644 --- a/external/profiles/profiles.go +++ b/external/profiles/profiles.go @@ -1,57 +1,60 @@ package profiles import ( - "crypto/sha256" - "encoding/hex" - "fmt" "github.com/elasticpath/epcc-cli/config" log "github.com/sirupsen/logrus" - "net/url" + "gopkg.in/ini.v1" "os" + "path/filepath" ) -func GetProfileName() string { - if config.Profile != "" { - log.Tracef("Using EPCC_PROFILE value for profile %s", config.Profile) - return config.Profile - } else { - u, err := url.Parse(config.Envs.EPCC_API_BASE_URL) - profileName := "" - if err != nil { - result := newSHA256([]byte(config.Envs.EPCC_CLIENT_ID + ":" + config.Envs.EPCC_API_BASE_URL)) - profileName = hex.EncodeToString(result) - } else { - profileName = fmt.Sprintf("%s-%s", u.Host, config.Envs.EPCC_CLIENT_ID) - } - - log.Tracef("Using auto generated profile name %s", profileName) +//profile name is set to config.Profile in InitConfig - return profileName +func getProfileDirectory() string { + home, err := os.UserHomeDir() + if err != nil { + log.Errorf("could not get home directory") + os.Exit(1) + } + configDir := home + "/.epcc/profiles_data" + configDir = filepath.FromSlash(configDir) + //built in check if dir exists + if err = os.MkdirAll(configDir, 0700); err != nil { + log.Errorf("could not make directory") } -} -func GetProfileDirectory() string { - profileDir := GetProfileDataBaseURL() + GetProfileName() + return configDir +} - log.Tracef("Creating profile directory %s", profileDir) - if err := os.MkdirAll(profileDir, 0700); err != nil { - panic(fmt.Sprintf("Could not create home directory %v", err)) +func GetProfilePath() string { + configPath := getProfileDirectory() + configPath = filepath.FromSlash(configPath + "/config") + if _, err := os.Stat(configPath); err != nil { + log.Trace("could not find file at " + configPath) + file, err := os.Create(configPath) + defer file.Close() + if err != nil { + log.Errorf("could not create file at " + configPath) + } + log.Trace("creating config file at " + configPath) } - return profileDir + return configPath } -func GetProfileDataBaseURL() string { - homeDir, err := os.UserHomeDir() +func GetProfile(name string) *config.Env { + result := config.Env{} + configPath := GetProfilePath() + cfg, err := ini.Load(configPath) if err != nil { - panic(fmt.Sprintf("Could not get user hoem directory home directory %v", err)) + log.Errorf("could not load file at " + configPath) + os.Exit(1) } + if !cfg.HasSection(name) { + log.Errorf("could not find profile in file") + os.Exit(1) + } + cfg.Section(name).MapTo(&result) + return &result - return homeDir + "/.epcc/profiles_data/" -} - -// NewSHA256 ... -func newSHA256(data []byte) []byte { - hash := sha256.Sum256(data) - return hash[:] } From fbdc56228bfaade3ebe7764dcc73840507f7374a Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 10:26:55 -0400 Subject: [PATCH 05/11] issue18 ran formatter agaian again --- cmd/configure.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/configure.go b/cmd/configure.go index d0acc880..416cff0c 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -54,4 +54,3 @@ func readInput(reader *bufio.Reader) string { response, _ := reader.ReadString('\n') return strings.TrimSuffix(response, "\n") } - From 8ddf5d3b9ae251f9be299bf8bda445de56288ba4 Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 10:37:43 -0400 Subject: [PATCH 06/11] issue18 name fix --- external/profiles/profiles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/profiles/profiles.go b/external/profiles/profiles.go index 76c535a5..c7dc2443 100644 --- a/external/profiles/profiles.go +++ b/external/profiles/profiles.go @@ -10,7 +10,7 @@ import ( //profile name is set to config.Profile in InitConfig -func getProfileDirectory() string { +func GetProfileDirectory() string { home, err := os.UserHomeDir() if err != nil { log.Errorf("could not get home directory") @@ -27,7 +27,7 @@ func getProfileDirectory() string { } func GetProfilePath() string { - configPath := getProfileDirectory() + configPath := GetProfileDirectory() configPath = filepath.FromSlash(configPath + "/config") if _, err := os.Stat(configPath); err != nil { log.Trace("could not find file at " + configPath) From 372fed7aa4a7b1abe397a12f421880b05d33f0b1 Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 10:46:40 -0400 Subject: [PATCH 07/11] issue18 fixed broken function call --- cmd/aliases.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/aliases.go b/cmd/aliases.go index 959ceb19..3953222c 100644 --- a/cmd/aliases.go +++ b/cmd/aliases.go @@ -61,7 +61,7 @@ var aliasClearCmd = &cobra.Command{ Use: "clear", Short: "clear all aliases", RunE: func(cmd *cobra.Command, args []string) error { - profileDirectory := profiles.GetProfileDataBaseURL() + profileDirectory := profiles.GetProfileDirectory() os.RemoveAll(profileDirectory) return nil }, From 3f3b24f508211f6022cbad94d656892d9b8a4f8f Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 13:14:31 -0400 Subject: [PATCH 08/11] issue18 minor ease of use tweaks to configure --- cmd/configure.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/cmd/configure.go b/cmd/configure.go index 416cff0c..5690ff5e 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -28,13 +28,18 @@ var configure = &cobra.Command{ println("Create new Profile") print("Profile Name:") text := readInput(reader) - print("Base URL:") + print("API Base URL [https://api.moltin.com]:") + if input := readInput(reader); input != "" { + newProfile.EPCC_API_BASE_URL = input + } else { + newProfile.EPCC_API_BASE_URL = "https://api.moltin.com" + } newProfile.EPCC_API_BASE_URL = readInput(reader) - print("Client ID:") + print("Client ID [None]:") newProfile.EPCC_CLIENT_ID = readInput(reader) - print("Client Secret:") + print("Client Secret [None]:") newProfile.EPCC_CLIENT_SECRET = readInput(reader) - print("Beta Features:") + print("(https://documentation.elasticpath.com/commerce-cloud/docs/api/basics/api-contract.html#beta-apis) [None]:") newProfile.EPCC_BETA_API_FEATURES = readInput(reader) section, err := cfg.NewSection(text) @@ -51,6 +56,11 @@ var configure = &cobra.Command{ } func readInput(reader *bufio.Reader) string { - response, _ := reader.ReadString('\n') - return strings.TrimSuffix(response, "\n") + response, err := reader.ReadString('\n') + if err != nil { + log.Errorf("error reading from stdin %s", err.Error()) + os.Exit(1) + } + response = strings.TrimSuffix(response, "\n") + return response } From d660643bbf6bd0a61341c7af1f236d4d2ae099ca Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 13:23:14 -0400 Subject: [PATCH 09/11] issue18 added configure to REDME --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dcb51b26..568f4bbd 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ export PATH=$PATH:($PWD) `epcc get customers` +5. To add more profiles to use try the following command: +`epcc configure` #### Simple CRUD From 128fe4bad3715ed10d282223797dd0275a140135 Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 13:41:21 -0400 Subject: [PATCH 10/11] issue18 minor changes --- cmd/configure.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/configure.go b/cmd/configure.go index 5690ff5e..eb768e53 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -34,7 +34,6 @@ var configure = &cobra.Command{ } else { newProfile.EPCC_API_BASE_URL = "https://api.moltin.com" } - newProfile.EPCC_API_BASE_URL = readInput(reader) print("Client ID [None]:") newProfile.EPCC_CLIENT_ID = readInput(reader) print("Client Secret [None]:") From 65773e60278773a9e651569674e10fb221ca56ad Mon Sep 17 00:00:00 2001 From: Connor Lynch Date: Tue, 12 Apr 2022 14:32:53 -0400 Subject: [PATCH 11/11] issue18 resolving conflicts --- cmd/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index e2162f83..c58abff1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/elasticpath/epcc-cli/config" "github.com/elasticpath/epcc-cli/external/logger" - "github.com/elasticpath/epcc-cli/external/profiles" + "github.com/elasticpath/epcc-cli/external/profiles" "github.com/elasticpath/epcc-cli/external/version" "github.com/elasticpath/epcc-cli/globals" log "github.com/sirupsen/logrus" @@ -50,7 +50,7 @@ func init() { RootCmd.PersistentFlags().BoolVarP(&json.MonochromeOutput, "monochrome-output", "M", false, "By default, epcc will output using colors if the terminal supports this. Use this option to disable it.") RootCmd.PersistentFlags().StringSliceVarP(&globals.RawHeaders, "header", "H", []string{}, "Extra headers and values to include in the request when sending HTTP to a server. You may specify any number of extra headers.") - rootCmd.PersistentFlags().StringVarP(&config.Profile, "profile", "P", "", "overrides the current EPCC_PROFILE var to run the command with the chosen profile.") + RootCmd.PersistentFlags().StringVarP(&config.Profile, "profile", "P", "", "overrides the current EPCC_PROFILE var to run the command with the chosen profile.") aliasesCmd.AddCommand(aliasListCmd, aliasClearCmd) }