mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 19:39:39 -08:00
fix(aws): override default region if AWS_REGION is set
Co-authored-by: Evgenii Morozov <emorozov@goodgamestudios.com>
This commit is contained in:
parent
f83fb24087
commit
84183b7506
|
@ -36,7 +36,7 @@ func (a *aws) enabled() bool {
|
|||
if !displayDefaultUser && a.Profile == defaultUser {
|
||||
return false
|
||||
}
|
||||
a.Region = getEnvFirstMatch("AWS_DEFAULT_REGION", "AWS_REGION")
|
||||
a.Region = getEnvFirstMatch("AWS_REGION", "AWS_DEFAULT_REGION")
|
||||
if a.Profile != "" && a.Region != "" {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ func TestAWSSegment(t *testing.T) {
|
|||
{Case: "enabled with default user", ExpectedString: "default@eu-west", Profile: "default", Region: "eu-west", ExpectedEnabled: true, DisplayDefault: true},
|
||||
{Case: "disabled with default user", ExpectedString: "default", Profile: "default", Region: "eu-west", ExpectedEnabled: false, DisplayDefault: false},
|
||||
{Case: "enabled no region", ExpectedString: "company", ExpectedEnabled: true, Profile: "company"},
|
||||
{Case: "enabled with region", ExpectedString: "company@eu-west", ExpectedEnabled: true, Profile: "company", Region: "eu-west"},
|
||||
{Case: "enabled with region", ExpectedString: "company@eu-west", ExpectedEnabled: true, Profile: "company", Region: "eu-west", DefaultRegion: "us-west"},
|
||||
{Case: "enabled with default region", ExpectedString: "company@us-west", ExpectedEnabled: true, Profile: "company", DefaultRegion: "us-west"},
|
||||
{
|
||||
Case: "template: enabled no region",
|
||||
ExpectedString: "profile: company",
|
||||
|
|
Loading…
Reference in a new issue