-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Velikiy Kirill edited this page Jun 12, 2024
·
3 revisions
pub fn init() !Env;
pub fn get(env: *Env, key: []const u8) ![]const u8;
pub fn deinit(env: *Env);The Env class in dotenv-zig is used for parsing and managing environment variables from a .env file.
To use the Env class, you first need to initialize it with the path to the .env file:
var env: Env = try Env.init(&allocator, ".env");You can then use the get method to retrieve environment variables:
const myVar = try env.get("MY_VAR");When you're done using the Env class, you should deinitialize it to free up resources:
env.deinit();