Skip to content

Have $env.ENV_CONVERSIONS changes take place immediately #14514

Closed

Description

@NotTheDr01ds

Related problem

Tossing this in so we don't lose track of it.

nu_engine::convert_env_values() is the function which handles ENV_CONVERSIONS for from_string. Currently, it has to be run "manually", so we do this several times during startup, basically whenever we know that we've changed, or assume that the user has changed, the $env.ENV_CONVERSIONS.

  1. Immediately after default_env.nu is evaluated, to pick up the PATH conversion in that file.
  2. Immediately before the user's config.nu so that any changes they've made in their env.nu can be used.
  3. After the user's env.nu in case they made any additional changes there.

Changes to the from_string in ENV_CONVERSIONS are never used.

Describe the solution you'd like

Things could be streamlined quite a bit if we run nu_engine::convert_env_values() any time that $env.ENV_CONVERSIONS is updated.

  1. We'd avoid a few potentially unnecessary calls.
  2. The user could change $env.ENV_CONVERSIONS and make use of them in the same file (e.g., config.nu). This could allow the user to go without an env.nu entirely in many cases.
  3. The user (or even third-party code) could update $env.ENV_CONVERSIONS at any point after startup and add new conversions.

Describe alternatives you've considered

No response

Additional context and details

No response

Activity

  1. added
    category:enhancement
    status:needs-triage
    on Dec 5, 2024
  2. added
    A:environment
    on Dec 5, 2024
  3. added a commit that references this issue on Dec 25, 2024
    1b01598
  4. added this to the v0.102.0 milestone on Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:environmentcategory:enhancementstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions