Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature: Make env search maintain provided order #69

Merged
merged 1 commit into from
Feb 3, 2024
Merged

Feature: Make env search maintain provided order #69

merged 1 commit into from
Feb 3, 2024

Conversation

rbingham
Copy link
Contributor

@rbingham rbingham commented Feb 3, 2024

WHAT

Keep order of envs provided by config.

WHY

Env files provided in config are ordered by character length. This causes envs with longer names to be ordered first (This includes folder names). When providing multiple env files to Hurl, the order provided is important as the right most files overwrite duplicate values in left most files. This means that variables in files with shorter names will always overwrite variables in files with longer names. Example:

require("hurl").setup({
  env_file = {
    'env-10.env',
    'env-1.env',
  },
})
# env-1.env
FOO=bar
#env-10.env
FOO=baz
#test.hurl
GET https://example.com/{{FOO}}

The above setup and files will generate this command hurl --variables-file env-10.env --variables-file env-1.env test.hurl which would execute this request https://example.com/bar.

With my changes, the above would generate this command hurl --variables-file env-1.env --variables-file env-10.env test.hurl which would execute this request https://example.com/baz

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Linter
  • Tests
  • Review comments
  • Security

Copy link

changeset-bot bot commented Feb 3, 2024

⚠️ No Changeset found

Latest commit: 51247db

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

sweep-ai bot commented Feb 3, 2024

Apply Sweep Rules to your PR?

  • Apply: All docstrings and comments should be up to date.
  • Apply: Commit messages should be descriptive and provide a clear explanation of the changes made.
  • Apply: Author names should be consistent and use proper formatting.
  • Apply: Code should be properly formatted and follow a consistent style guide.
  • Apply: There should be no unnecessary whitespace or trailing spaces in the code.
  • Apply: Variable and function names should be meaningful and descriptive.

This is an automated message generated by Sweep AI.

Copy link
Owner

@jellydn jellydn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks, @rbingham

@jellydn jellydn merged commit 275368b into jellydn:main Feb 3, 2024
5 checks passed
@jellydn
Copy link
Owner

jellydn commented Feb 3, 2024

@all-contributors add @rbingham for code.

Copy link
Contributor

@jellydn

I've put up a pull request to add @rbingham! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants