Skip to content

Commit

Permalink
Remove AutoConfigCheck config option
Browse files Browse the repository at this point in the history
Refs: #610
  • Loading branch information
synfinatic committed Nov 1, 2023
1 parent cbc8219 commit ff22c27
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 150 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Remove `CacheRefresh` configuration option. `aws-sso` will only update the cache
when you ask it to via `aws-sso cache`
* Remove `tags --force-update` flag
* Remove `AutoConfigCheck` configuration option.

## [v1.14.2] - 2023-10-19

Expand Down
12 changes: 5 additions & 7 deletions cmd/aws-sso/cache_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ func (cc *CacheCmd) Run(ctx *RunContext) error {
}

// should we update our config??
if !ctx.Cli.Cache.NoConfigCheck && ctx.Settings.AutoConfigCheck {
if ctx.Settings.ConfigProfilesUrlAction != url.ConfigProfilesUndef {
action, _ := url.NewAction(string(ctx.Settings.ConfigProfilesUrlAction))
err := awsconfig.UpdateAwsConfig(ctx.Settings, action, "", true, false)
if err != nil {
log.Errorf("Unable to auto-update aws config file: %s", err.Error())
}
if !ctx.Cli.Cache.NoConfigCheck && ctx.Settings.ConfigProfilesUrlAction != url.ConfigProfilesUndef {
action, _ := url.NewAction(string(ctx.Settings.ConfigProfilesUrlAction))
err := awsconfig.UpdateAwsConfig(ctx.Settings, action, "", true, false)
if err != nil {
log.Errorf("Unable to auto-update aws config file: %s", err.Error())
}
}

Expand Down
24 changes: 0 additions & 24 deletions cmd/aws-sso/config_wizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,30 +582,6 @@ func index(s []string, v string) int {
return 0
}

func promptAutoConfigCheck(flag bool) bool {
var i int = -1
var err error

fmt.Printf("\n")

label := "Auto update ~/.aws/config with latest AWS SSO roles? (AutoConfigCheck)"
for i < 0 {
sel := promptui.Select{
Label: label,
Items: yesNoItems,
CursorPos: yesNoPos(flag),
HideSelected: false,
Stdout: &utils.BellSkipper{},
Templates: makeSelectTemplate(label),
}
if i, _, err = sel.Run(); err != nil {
checkSelectError(err)
}
}

return yesNoItems[i].Value == "Yes"
}

func promptFullTextSearch(flag bool) bool {
var i int = -1
var err error
Expand Down
1 change: 0 additions & 1 deletion cmd/aws-sso/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ var DEFAULT_CONFIG map[string]interface{} = map[string]interface{}{
"PromptColors.SelectedSuggestionTextColor": "White",
"PromptColors.SuggestionBGColor": "Cyan",
"PromptColors.SuggestionTextColor": "White",
"AutoConfigCheck": false,
"ConfigProfilesUrlAction": "open",
"ConsoleDuration": 60,
"DefaultRegion": "us-east-1",
Expand Down
3 changes: 0 additions & 3 deletions cmd/aws-sso/setup_wizard_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func setupWizard(ctx *RunContext, reconfig, addSSO, advanced bool) error {
LogLevel: "error",
DefaultRegion: defaultRegion,
ConsoleDuration: 720,
AutoConfigCheck: false,
FullTextSearch: true,
HistoryLimit: 10,
HistoryMinutes: 1440,
Expand All @@ -117,8 +116,6 @@ func setupWizard(ctx *RunContext, reconfig, addSSO, advanced bool) error {
s.ProfileFormat = promptProfileFormat(s.ProfileFormat)

if advanced {
s.AutoConfigCheck = promptAutoConfigCheck(s.AutoConfigCheck)

// full text search?
s.FullTextSearch = promptFullTextSearch(s.FullTextSearch)

Expand Down
101 changes: 4 additions & 97 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,100 +56,6 @@ For information about the ECS Server functionality, see the [ecs-server](ecs-ser

---

### setup

#### setup all

Runs the initial setup of `aws-sso`. By default it will run through the setup wizard,
shell script installation and configuration of your AWS SSO enabled profiles in `~/.aws/config`.

#### setup wizard

Allows you to run through the configuration wizard and update your AWS SSO CLI
config file (`~/.aws-sso/config.yaml`). By default, it only does a very basic
configuration to get started with. The `--advanced` flag prompts for more
settings and is useful for taking advantage of some of the new settings if
you've upgraded from a previous version!

Flags:

* `--advanced` -- Prompts for many more config options

#### setup shell

Configures your appropriate shell configuration file to add auto-complete
and [Shell Helpers](#shell-helpers) functionality for commands, flags and
options. Must restart your shell for this to take effect.

For more information about this feature, please read [the quickstart](
quickstart.md#enabling-auto-completion-in-your-shell).

Flags:

* `--install` -- Install the new v1.9+ shell completions scripts
* `--uninstall` -- Uninstall the new v1.9+ shell completions scripts
* `--uninstall-pre-19` -- Uninstall the legacy pre-v1.9 scripts
* `--shell <shell>` -- Override the detected shell
* `--shell-script <file>` -- Override the default shell script file to modify

**Note:** You should uninstall the older pre-v1.9 completions before installing
the new version. Once the new version is installed, `--uninstall-pre-19` will
refuse to run so you will have to either manually edit the file or run
`--uninstall`, then `--uninstall-pre-19` and finally `--install` again.

#### setup aws-config

Modifies the `~/.aws/config` file to contain a [named profile](
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-using-profiles)
for every role accessible via AWS SSO CLI.

Flags:

* `--diff` -- Print a diff of changes to the config file instead of modifying it
* `--open` -- Specify how to open URls: [clip|exec|open]
* `--print` -- Print profile entries instead of modifying config file
* `--force` -- Write a new config file without prompting
* `--aws-config` -- Override path to `~/.aws/config` file

By default, each profile is named according to the [ProfileFormat](
config.md#profileformat) config option or overridden by the user defined
[Profile](config.md#profile) option on a role by role basis.

For each profile generated, it will specify a [list of settings](
https://docs.aws.amazon.com/sdkref/latest/guide/settings-global.html) as defined
by the [ConfigVariables](config.md#configvariables) setting in the
`~/.aws-sso/config.yaml`.

For more information on this feature, [read the Quickstart Guide](
quickstart.md#integrating-with-the-aws-profile-variable).

Unlike with other ways to use AWS SSO CLI, the AWS IAM STS credentials will
_automatically refresh_. This means, if you do not have a valid AWS SSO token,
you will be prompted to authentiate via your SSO provider and subsequent
requests to obtain new IAM STS credentials will automatically happen as needed.

**Note:** Due to a limitation in the AWS tooling, `print` and `printurl` are not
supported values for `--url-action`. Hence, you must use `open` or `exec` to
auto-open URLs in your browser (recommended) or `clip` to automatically copy
URLs to your clipboard. _No user prompting is possible._

**Note:** You should run this command any time your list of AWS roles changes
in order to update the `~/.aws/config` file or enable [AutoConfigCheck](
config.md#autoconfigcheck) and [ConfigProfilesUrlAction](
config.md#configprofilesurlaction).

**Note:** If `ConfigProfilesUrlAction` is set, then `--open` is optional,
otherwise it is required.

**Note:** It is important that you do _NOT_ remove the `# BEGIN_AWS_SSO_CLI` and
`# END_AWS_SSO_CLI` lines from your config file! These markers are used to track
which profiles are managed by AWS SSO CLI.

**Note:** This command does not honor the `--sso` option as it operates on all
of the configured AWS SSO instances in the `~/.aws-sso/config.yaml` file.

---

### eval

Generate a series of `export VARIABLE=VALUE` lines suitable for sourcing into your
Expand Down Expand Up @@ -437,9 +343,9 @@ auto-open URLs in your browser (recommended) or `clip` to automatically copy
URLs to your clipboard. _No user prompting is possible._

**Note:** You should run this command any time your list of AWS roles changes
in order to update the `~/.aws/config` file or enable [AutoConfigCheck](
config.md#autoconfigcheck) and [ConfigProfilesUrlAction](
config.md#configprofilesurlaction).
in order to update the `~/.aws/config` file or set [ConfigProfilesUrlAction](
config.md#configprofilesurlaction) and the [cache commands](#cache) will
prompt you.

**Note:** If `ConfigProfilesUrlAction` is set, then `--open` is optional,
otherwise it is required.
Expand All @@ -450,6 +356,7 @@ which profiles are managed by AWS SSO CLI.

**Note:** This command does not honor the `--sso` option as it operates on all
of the configured AWS SSO instances in the `~/.aws-sso/config.yaml` file.

---

### time
Expand Down
19 changes: 3 additions & 16 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ SSOConfig:
# See description below for these options
DefaultRegion: <AWS_DEFAULT_REGION>
DefaultSSO: <name of AWS SSO>
AutoConfigCheck: [False|True]
Threads: <integer>
MaxRetry: <integer>
MaxBackoff: <integer>
Expand Down Expand Up @@ -324,6 +323,9 @@ https://docs.aws.amazon.com/singlesignon/latest/userguide/howtosessionduration.h

#### ConfigProfilesUrlAction

Setting `ConfigProfilesUrlAction` enables automatically updating your `~/.aws/config`
file any time the list of IAM Roles you are given access to changes.

This works just like `UrlAction` above, but is used for setting the default
`--url-action` in your `~/.aws/config` when generating named AWS profiles for
use with `$AWS_PROFILE` and the default value for the [config-profiles](
Expand All @@ -337,9 +339,6 @@ Due to limitations with the AWS SDK, only the following options are valid:
* `granted-containers`
* `open-url-in-container`

**Note:** This option is required if you also want to use
[AutoConfigCheck](#autoconfigcheck).

**Note:** This config option was previously known as `ConfigUrlAction` which
has been deprecated.

Expand Down Expand Up @@ -512,18 +511,6 @@ Specify which fields to display via the `list` command. Valid options are:
* `SSO` -- AWS SSO instance name
* `Via` -- Role Chain Via

#### AutoConfigCheck

**Note:** This option requires you to also set
[ConfigProfilesUrlAction](#configprofilesurlaction).

**Note:** This option can be disabled temporarily on the command line by passing
the `--no-config-check` flag.

**Note:** If you are using a non-default path for your `~/.aws/config` file, then
you must be sure to set the `AWS_CONFIG_FILE` environment variable to the correct
path or disable this configuration option.

#### LogLevel / LogLines

By default, the `LogLevel` is 'warn'. You can override it here or via
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ For more information about this feature, see the following sections of the confi
docs:

* [ProfileFormat](config.md#profileformat) and [Profile](config.md#profile)
* [AutoConfigCheck / ConfigUrlAction](config.md#autoconfigcheck-configurlaction)
* [ConfigProfilesUrlAction](config.md#configprofilesurlaction)
* [ConfigVariables](config.md#configvariables)


Expand Down
1 change: 0 additions & 1 deletion sso/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type Settings struct {
Threads int `koanf:"Threads" yaml:"Threads,omitempty"`
MaxBackoff int `koanf:"MaxBackoff" yaml:"MaxBackoff,omitempty"`
MaxRetry int `koanf:"MaxRetry" yaml:"MaxRetry,omitempty"`
AutoConfigCheck bool `koanf:"AutoConfigCheck" yaml:"AutoConfigCheck,omitempty"`
FirefoxOpenUrlInContainer bool `koanf:"FirefoxOpenUrlInContainer" yaml:"FirefoxOpenUrlInContainer,omitempty"` // deprecated
UrlAction url.Action `koanf:"UrlAction" yaml:"UrlAction"`
Browser string `koanf:"Browser" yaml:"Browser,omitempty"`
Expand Down

0 comments on commit ff22c27

Please sign in to comment.