Code Monkey home page Code Monkey logo

dotenvy's Introduction

dotenvy

crates.io CI Released API docs codecov

A well-maintained fork of the dotenv crate.

This library loads environment variables from a .env file. This is convenient for dev environments.

Components

  1. dotenvy crate - A well-maintained fork of the dotenv crate.
  2. dotenvy_macro crate - A macro for compile time dotenv inspection. This is a fork of dotenv_codegen.
  3. dotenvy_codgen_impl crate - Internal implementation for dotenvy_codegen.
  4. dotenvy CLI tool for running a command using the environment from a .env file (currently Unix only)

Usage

Loading at runtime

use dotenvy::dotenv;
use std::env;

fn main() {
    dotenv().ok();

    for (key, value) in env::vars() {
        println!("{key}: {value}");
    }
}

Loading at compile time

The dotenv! macro provided by dotenvy_macro crate can be used.

Warning: there is an outstanding issue with rust-analyzer (rust-analyzer #9606) related to the dotenv! macro

Why does this fork exist?

The original dotenv crate has not been updated since June 26, 2020. Attempts to reach the authors and present maintainer were not successful (dotenv-rs/dotenv #74).

This fork is intended to serve as the development home for the dotenv implementation in Rust.

What are the differences from the original?

This repo fixes:

  • home directory works correctly (no longer using the deprecated std::env::home_dir)
  • more helpful errors for dotenv! (dotenv-rs/dotenv #57)

For a full list of changes, read the changelog.

The legend

Legend has it that the Lost Maintainer will return, merging changes from dotenvy into dotenv with such thrust that all Cargo.tomls will lose one keystroke. Only then shall the Rust dotenv crateverse be united in true harmony.

Until then, this repo dutifully carries on the dotenv torch. It is actively maintained. Contributions and PRs are very welcome!

dotenvy's People

Contributors

alicemaz avatar allan2 avatar barosl avatar carols10cents avatar casey avatar chills42 avatar daboross avatar eijebong avatar elifoster avatar euclio avatar geogi avatar golddranks avatar imp avatar mcasper avatar mfpiccolo avatar mrmaxmeier avatar nashenas88 avatar omerbenamram avatar pfernie avatar plecra avatar sergiobenitez avatar sgrif avatar sharplet avatar shepmaster avatar someonetoignore avatar swatinem avatar unflxw avatar uvd avatar zoeyr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.