diff --git a/cmd/auth/profiles.go b/cmd/auth/profiles.go index 5ebea444..797eb3b5 100644 --- a/cmd/auth/profiles.go +++ b/cmd/auth/profiles.go @@ -29,10 +29,11 @@ func (c *profileMetadata) IsEmpty() bool { return c.Host == "" && c.AccountID == "" } -func (c *profileMetadata) Load(ctx context.Context, skipValidate bool) { +func (c *profileMetadata) Load(ctx context.Context, configFilePath string, skipValidate bool) { cfg := &config.Config{ - Loaders: []config.Loader{config.ConfigFile}, - Profile: c.Name, + Loaders: []config.Loader{config.ConfigFile}, + ConfigFile: configFilePath, + Profile: c.Name, } _ = cfg.EnsureResolved() if cfg.IsAws() { @@ -117,7 +118,7 @@ func newProfilesCommand() *cobra.Command { go func() { ctx := cmd.Context() t := time.Now() - profile.Load(ctx, skipValidate) + profile.Load(ctx, iniFile.Path(), skipValidate) log.Debugf(ctx, "Profile %q took %s to load", profile.Name, time.Since(t)) wg.Done() }() diff --git a/cmd/auth/profiles_test.go b/cmd/auth/profiles_test.go index 8a667a6d..91ff4d04 100644 --- a/cmd/auth/profiles_test.go +++ b/cmd/auth/profiles_test.go @@ -36,7 +36,7 @@ func TestProfiles(t *testing.T) { // Load the profile profile := &profileMetadata{Name: "profile1"} - profile.Load(ctx, true) + profile.Load(ctx, configFile, true) // Check the profile assert.Equal(t, "profile1", profile.Name)