1/velikoss/dotenv-zig v0.12
.env for Zig
dotenv-zig
dotenv-zig is a Zig library for parsing and managing environment variables from a .env
file. It provides a simple and efficient way to load environment variables into your Zig applications.
Features
- Parse
.env
files and load environment variables into your application. - Support for key-value pairs separated by
=
in the.env
file. - Easily integrate with existing Zig projects.
- No dependencies needed.
Installation
Install dotenv-zig using zigmod:
zigmod aq add dotenv-zig
Also you can install it using Zon
Usage
-
Create a
.env
file in your project or executable directory:# .env MY_ENV_VAR=hello ANOTHER_VAR=world
-
Use dotenv-zig to load the environment variables in your Zig code:
const dotenv = @import("dotenv-zig"); pub fn main() void { var allocator = std.heap.c_allocator; var env: Env = try Env.init(); const myEnvVar = try env.get("MY_ENV_VAR"); const anotherVar = try env.get("ANOTHER_VAR"); // Use the environment variables // ... }
More information
Seeking for more info? Look at Wiki
Contributing
Contributions are welcome! Fork the repository and submit a pull request.
License
dotenv-zig is licensed under the MIT License. See LICENSE for details.
Package Contents
- licenses.txt
- zigmod.lock
- LICENSE
- build.zig
- .env
- zigmod.yml
- src/root.zig
- README.md
- build.zig.zon
- .gitignore
History
Published On | Tree @ Commit | Size | |
---|---|---|---|
v0.12 | Wed, 12 Jun 2024 15:34:02 UTC | Tree | 10.964 KB |
v0.11 | Wed, 12 Jun 2024 15:25:43 UTC | Tree | 10.912 KB |
v0.10 | Wed, 12 Jun 2024 15:22:48 UTC | Tree | 10.857 KB |
v0.9 | Wed, 12 Jun 2024 15:21:54 UTC | Tree | 10.875 KB |
v0.8 | Wed, 12 Jun 2024 14:37:08 UTC | Tree | 10.860 KB |
v0.7 | Wed, 12 Jun 2024 14:35:42 UTC | Tree | 10.813 KB |
v0.6 | Wed, 12 Jun 2024 14:33:30 UTC | Tree | 12.354 KB |
v0.5 | Wed, 12 Jun 2024 14:27:44 UTC | Tree | 12.329 KB |
v0.4 | Wed, 12 Jun 2024 14:27:32 UTC | Tree | 12.333 KB |
v0.3 | Wed, 12 Jun 2024 14:26:47 UTC | Tree | 12.337 KB |
v0.2 | Wed, 12 Jun 2024 09:33:53 UTC | Tree | 12.254 KB |
v0.1 | Wed, 12 Jun 2024 09:18:57 UTC | Tree | 12.152 KB |