Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CLI config refactor and improvements #324

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Conversation

swalkinshaw
Copy link
Member

@swalkinshaw swalkinshaw commented Sep 24, 2022

Adds a new cli_config package which allows for setting CLI config values from multiple files and ENV variables. The precedence from lowest to highest is:

  1. global config
  2. project config
  3. env variables

The global CLI config (defaults to $HOME/.config/trellis/cli.yml) and will be loaded first on boot (if it exists).

Next the project CLI config will be loaded if a projected is detected ($PROJECT/.trellis/cli.yml).

Finally, env variables prefixed with TRELLIS_ will be used as overrides if they match a supported configuration setting.

Current supported settings:

Setting Description Type Default
ask_vault_pass Set Ansible to always ask for the vault pass boolean false
check_for_updates Whether to check for new versions of trellis-cli boolean true
load_plugins Load external CLI plugins boolean true
open List of name -> URL shortcuts map[string]string none
virtualenv_integration Enable automated virtualenv integration boolean true

Example config:

ask_vault_pass: false
check_for_updates: true
load_plugins: true
open:
  site: "https://mysite.com"
  admin: "https://mysite.com/wp/wp-admin"
virtualenv_integration: true

Example env var usage:

TRELLIS_ASK_VAULT_PASS=true trellis provision production

@swalkinshaw swalkinshaw force-pushed the cli-config-refactor branch 3 times, most recently from f61e7f3 to f80af12 Compare September 24, 2022 04:16
@swalkinshaw swalkinshaw requested a review from retlehs September 24, 2022 18:42
@swalkinshaw swalkinshaw force-pushed the cli-config-refactor branch 4 times, most recently from 193c260 to a52d0f9 Compare September 25, 2022 19:13
Adds a new cli_config package which allows for setting CLI config values
from multiple files and ENV variables. The precedence from lowest to
highest is:

1. global config
2. project config
3. env variables

The global CLI config (defaults to `$HOME/.config/trellis/cli.yml`)
and will be loaded first on boot (if it exists).

Next the project CLI config will be loaded if a projected is detected
(`$PROJECT/.trellis/cli.yml`).

Finally, env variables prefixed with `TRELLIS_` will be used as
overrides if they match a supported configuration setting.
@swalkinshaw swalkinshaw merged commit e4bd4a9 into master Oct 10, 2022
@swalkinshaw swalkinshaw deleted the cli-config-refactor branch October 10, 2022 22:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant