diff --git a/README.md b/README.md index a3f6f48d3..74e86281c 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ v20.0.0 - [`~/.cache/rtx`](#cachertx) - [`~/.local/share/rtx`](#localsharertx) - [Templates](#templates) -- [[experimental] Config Environments](#experimental-config-environments) +- [Config Environments](#config-environments) - [IDE Integration](#ide-integration) - [Core Plugins](#core-plugins) - [FAQs](#faqs) @@ -611,7 +611,7 @@ Then when inside of `~/src/myproj/backend`, `node` will be `18`, `python` will b will be `3.1`. You can check the active versions with `rtx ls --current`. You can also have environment specific config files like `.rtx.production.toml`, see -[Config Environments](#experimental-config-environments) for more details. +[Config Environments](#config-environments) for more details. #### `[env]` - Arbitrary Environment Variables @@ -835,12 +835,12 @@ a different name. Set to something other than `.rtx.toml` to have rtx look for `.rtx.toml` config files with a different name. -#### [experimental] `RTX_ENV` +#### `RTX_ENV` Enables environment-specific config files such as `.rtx.development.toml`. Use this for different env vars or different tool versions in development/staging/production environments. See -[Config Environments](#experimental-config-environments) for more on how +[Config Environments](#config-environments) for more on how to use this feature. #### `RTX_USE_VERSIONS_HOST` @@ -1123,10 +1123,6 @@ does not work for some reason. ## Templates -> **Warning** -> -> This functionality is experimental and may change in the future. - Templates are used in the following locations: - `.tool-versions` files @@ -1157,11 +1153,10 @@ Here's another using `exec()`: current = "{{exec(command='node --version')}}" ``` -## [experimental] Config Environments +## Config Environments It's possible to have separate `.rtx.toml` files in the same directory for different -environments like `development` and `production`. To enable, set -`experimental = true` in `~/.config/rtx/config.toml`, then set `RTX_ENV` to an environment like +environments like `development` and `production`. To enable, set `RTX_ENV` to an environment like `development` or `production`. rtx will then look for a `.rtx.{RTX_ENV}.toml` file in the current directory. rtx will also look for "local" files like `.rtx.local.toml` and `.rtx.{RTX_ENV}.local.toml` in @@ -2709,7 +2704,7 @@ Options: Use the global config file (~/.config/rtx/config.toml) instead of the local one -e, --env - [experimental] Modify an environment-specific config file like .rtx..toml + Modify an environment-specific config file like .rtx..toml -p, --path Specify a path to a config file or directory If a directory is specified, it will look for .rtx.toml (default) or .tool-versions diff --git a/completions/_rtx b/completions/_rtx index 64dbc6294..13940684a 100644 --- a/completions/_rtx +++ b/completions/_rtx @@ -736,7 +736,7 @@ __rtx_use_cmd() { '--fuzzy[Save fuzzy version to config file]' \ '*--remove=[Remove the tool(s) from config file]:remove:' \ '(-g --global)'{-g,--global}'[Use the global config file (~/.config/rtx/config.toml) instead of the local one]' \ - '(-e --env)'{-e,--env}'=[\[experimental\] Modify an environment-specific config file like .rtx..toml]:env:' \ + '(-e --env)'{-e,--env}'=[Modify an environment-specific config file like .rtx..toml]:env:' \ '(-p --path)'{-p,--path}'=[Specify a path to a config file or directory If a directory is specified, it will look for .rtx.toml (default) or .tool-versions]:path:_files' \ '(-j --jobs)'{-j,--jobs}'=[Number of plugins and runtimes to install in parallel]:jobs:' \ '(-q --quiet)'{-q,--quiet}'[Suppress output]' \ diff --git a/completions/rtx.fish b/completions/rtx.fish index ac6a6f3d1..fb17426ad 100644 --- a/completions/rtx.fish +++ b/completions/rtx.fish @@ -255,7 +255,7 @@ complete -xc rtx -n "$fssf upgrade" -s n -l dry-run -d 'Just print what would be complete -xc rtx -n "$fssf upgrade" -a "(__rtx_tool_versions)" -d 'Tool(s) to upgrade' # use -complete -xc rtx -n "$fssf use" -s e -l env -d '[experimental] Modify an environment-specific config file like .rtx..toml' +complete -xc rtx -n "$fssf use" -s e -l env -d 'Modify an environment-specific config file like .rtx..toml' complete -xc rtx -n "$fssf use" -l fuzzy -d 'Save fuzzy version to config file' complete -xc rtx -n "$fssf use" -s g -l global -d 'Use the global config file (~/.config/rtx/config.toml) instead of the local one' complete -xc rtx -n "$fssf use" -s p -l path -a "(__fish_complete_path)" -d 'Specify a path to a config file or directory If a directory is specified, it will look for .rtx.toml (default) or .tool-versions' diff --git a/src/cli/use.rs b/src/cli/use.rs index 96fee8f1b..22b6f357c 100644 --- a/src/cli/use.rs +++ b/src/cli/use.rs @@ -53,7 +53,7 @@ pub struct Use { #[clap(short, long, overrides_with_all = &["path", "env"])] global: bool, - /// [experimental] Modify an environment-specific config file like .rtx..toml + /// Modify an environment-specific config file like .rtx..toml #[clap(long, short, overrides_with_all = &["global", "path"])] env: Option, diff --git a/src/config/mod.rs b/src/config/mod.rs index 720e058fb..db7ee6eb7 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -52,10 +52,10 @@ pub struct Config { impl Config { pub fn load() -> Result { let global_config = load_rtxrc()?; + let config_filenames = load_config_filenames(&BTreeMap::new()); let settings = Settings::default_builder() .preloaded(global_config.settings()?) .load()?; - let config_filenames = load_config_filenames(&settings, &BTreeMap::new()); let plugins = load_plugins(&settings)?; let config_files = load_all_config_files( &settings, @@ -72,7 +72,7 @@ impl Config { trace!("Settings: {:#?}", settings); let legacy_files = load_legacy_files(&settings, &plugins); - let config_filenames = load_config_filenames(&settings, &legacy_files); + let config_filenames = load_config_filenames(&legacy_files); let config_track = track_config_files(&config_filenames); let config_files = load_all_config_files( @@ -99,10 +99,6 @@ impl Config { let (env, env_sources) = load_env(&config_files); - if !settings.experimental && env::RTX_ENV.is_some() { - warn!("RTX_ENV is set but RTX_EXPERIMENTAL is not. Ignoring RTX_ENV."); - } - let config = Self { env, env_sources, @@ -330,14 +326,11 @@ fn load_legacy_files(settings: &Settings, tools: &PluginMap) -> BTreeMap>, -) -> Vec { +fn load_config_filenames(legacy_filenames: &BTreeMap>) -> Vec { let mut filenames = legacy_filenames.keys().cloned().collect_vec(); filenames.push(env::RTX_DEFAULT_TOOL_VERSIONS_FILENAME.clone()); filenames.push(env::RTX_DEFAULT_CONFIG_FILENAME.clone()); - if settings.experimental && *env::RTX_DEFAULT_CONFIG_FILENAME == ".rtx.toml" { + if *env::RTX_DEFAULT_CONFIG_FILENAME == ".rtx.toml" { filenames.push(".rtx.local.toml".to_string()); if let Some(env) = &*env::RTX_ENV { filenames.push(format!(".rtx.{}.toml", env));