compile-dotenv
Add environment variables defined in the environment or in a .env file at compile time.
Description
The compile-dotenv library helps you manage environment variables by allowing you to inject them at compile time.
This can be particularly useful for configuring applications across different environments without hardcoding sensitive or environment-specific data.
Features
- Load environment variables from a
.envfile. - Inject environment variables during the compilation process.
- Simplify environment configuration for your Rust applications.
Installation
To add compile-dotenv to your project, add the following line to your Cargo.toml file:
[]
= "0.1.0"
Usage
Here is a simple example of how to use compile-dotenv in your Rust project:
-
Create a
.envfile in the root of your project:SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0 -
Use
compile-dotenvto instantiate a Sentry guard in yourmain.rsor any other part of your application:use compile_env;