atproto relay in zig zlay.waow.tech
relay zig atproto
Something went wrong. Try again.
Zig
12345678910111213141516171819//! env — process environment helpers.//!//! std.posix.getenv was removed in zig 0.16; this wraps libc getenv so the//! four call sites that needed it don't each re-declare the extern shim.
const std = @import("std");
/// libc getenv — returns the value as a slice, or null if unset.pub fn getenv(key: [*:0]const u8) ?[]const u8 { const ptr = std.c.getenv(key) orelse return null; return std.mem.sliceTo(ptr, 0);}
/// parse an integer-valued env var, falling back to `default` if unset or unparseable.pub fn parseEnvInt(comptime T: type, key: [*:0]const u8, default: T) T { const val = getenv(key) orelse return default; return std.fmt.parseInt(T, val, 10) catch default;}