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

v0.16 new API #123

Merged
merged 39 commits into from
Sep 9, 2024
Merged

v0.16 new API #123

merged 39 commits into from
Sep 9, 2024

Commits on Aug 29, 2024

  1. Use 2024 edition, mark unsafe

    `set::env_set_var` is unsafe in the 2024 edition.
    All functions calling it are marked as unsafe.
    allan2 committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    a45eeda View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. New API

    - dotenv moved to dotenvy folder
    - dotenvy-macros crate created for runtime macros
    - temporary 2024 edition to check for unsafe `set_var` usage
    - new API with `EnvLoader` builder, `load`, and `load_and_modify`
    - `load` attribute macro that is thread-safe and async-compatible
    - many examples added
    - some irrelevant tests removed
    allan2 committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    fa19b77 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2024

  1. Rename from_path to with_path

    This naming better reflects the fact that we are configuring a loader
    with an optional path, with deferred I/O.
    allan2 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    5012a99 View commit details
    Browse the repository at this point in the history
  2. New Error type with NotPresent(String)

    This removes the `EnvVar` variant which wraps `VarError`.
    The internals of `VarError` are now variants in `Error`.
    
    This makes it more ergonomic for users who are propogating errors to
    know which varaible is truly missing.
    allan2 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    0f9ad5f View commit details
    Browse the repository at this point in the history
  3. Add dotenvy::var with new error type

    This reintroduces `var` as a copy of `std::env::var` with more info.
    The signature is different because in this crate, we only handle valid
    UTF-8.
    
    Calling `var` now gives the key name in the error.
    allan2 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    b585c41 View commit details
    Browse the repository at this point in the history
  4. Make a EnvMap a newtype with EnvMap::var

    This change `EnvMap` to a newtype with a `var` function that returns
    `Result`.
    This mirrors the behaviour of `dotenvy::var`.
    allan2 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    13231f6 View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. Add version display for CLI

    allan2 committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    2fac955 View commit details
    Browse the repository at this point in the history
  2. Add required and override to CLI

    This makes the CLI feature aligned with the attribute macro.
    
    The optional example is also updated to be similar to the CLI.
    `Path::exists` is no longer used because of a potential race condition.
    allan2 committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    6334ceb View commit details
    Browse the repository at this point in the history
  3. Add variable name to Unicode error

    Error messages are also adjusted.
    allan2 committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    9ad1045 View commit details
    Browse the repository at this point in the history
  4. Fix error usage

    allan2 committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    c4263c8 View commit details
    Browse the repository at this point in the history
  5. cargo fmt

    allan2 committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    81dd772 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2024

  1. Add file path to IO error variant

    This creates an internal `ParseBufError` to handle line parsing errors
    without the path context.
    
    Loading a file reports the file path error if an attempt was made to
    read from it and it is not found.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    cb5be8d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    312fac6 View commit details
    Browse the repository at this point in the history
  3. Add path setter for reader error context

    `EnvLoader::path` is a setter that can be used to specify the path.
    If `with_reader` is used, the path can be specified for error context.
    
    If both reader and path are present, load will use the reader as input.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    9b3e9ad View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d7d0128 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c788494 View commit details
    Browse the repository at this point in the history
  6. Remove default location tests

    Now that we only use paths and there is also reader input, we don't need
    to test with temp file creating and deleting.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    fe46d1d View commit details
    Browse the repository at this point in the history
  7. Remove panics from parse unit tests

    The tests are also rewritten for clarity.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    b426cbf View commit details
    Browse the repository at this point in the history
  8. Remove deprecated test

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    3b05ea8 View commit details
    Browse the repository at this point in the history
  9. Use safe API in mutiline tests

    Tests are also moved from separate files to the `EnvLoader` module.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    ec0b6a3 View commit details
    Browse the repository at this point in the history
  10. Remove unused test dir

    The integration tests are no longer being used.
    Testing is done at lower levels and will be stored as modules.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    d07c421 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f72df37 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    aa2a0e1 View commit details
    Browse the repository at this point in the history
  13. Minor signature syntax

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    20847a4 View commit details
    Browse the repository at this point in the history
  14. Add load tests, use temp-env

    Unit tests run in parallel and may clobber each other.
    temp-env is now a dev dependency to ensure that unit tests run in
    isolated enviornments.
    
    Some tests are added for `load` and `load_and_modify`.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    befc817 View commit details
    Browse the repository at this point in the history
  15. Revert edition to 2021

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    faeba1b View commit details
    Browse the repository at this point in the history
  16. Update MSRV to 1.74.0

    This is to build with clap_builder v4.5.17, which requires 17.4.0.
    1.74.0 came out November 2023, so this is less than one year ago.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    92158d9 View commit details
    Browse the repository at this point in the history
  17. Remove unnecessary extern

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    5b4313a View commit details
    Browse the repository at this point in the history
  18. Conditional Unix use

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    23aade4 View commit details
    Browse the repository at this point in the history
  19. Remove die macro

    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    f4dec21 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    6822a04 View commit details
    Browse the repository at this point in the history
  21. Attempt to fix Windows build

    `cmd.exec` was accessible to the Windows code path, while also being
    unreachable do to `exit(1)`.
    allan2 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    9663c8a View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. Fix env file spelling

    We consistenly use "env file" across the repo now.
    allan2 committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    43a167e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab5b754 View commit details
    Browse the repository at this point in the history
  3. Upgrade syn 1 to syn 2

    `override` argument named to `override_` because it is a keyword.
    allan2 committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    a8ff414 View commit details
    Browse the repository at this point in the history
  4. Fix default path

    allan2 committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    9b3db89 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    deb2b49 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    169a60e View commit details
    Browse the repository at this point in the history
  7. Fix default construction path

    allan2 committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    c2070b0 View commit details
    Browse the repository at this point in the history