aboutsummaryrefslogtreecommitdiff
path: root/src/env_loader.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/env_loader.zig')
-rw-r--r--src/env_loader.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/env_loader.zig b/src/env_loader.zig
index a36956424..f680ea371 100644
--- a/src/env_loader.zig
+++ b/src/env_loader.zig
@@ -396,6 +396,21 @@ pub const Loader = struct {
const empty_string_value: string = "\"\"";
+ pub fn get(this: *const Loader, key: string) ?string {
+ var _key = key;
+ if (_key.len > 0 and _key[0] == '$') {
+ _key = key[1..];
+ }
+
+ if (_key.len == 0) return null;
+
+ return this.map.get(_key);
+ }
+
+ pub fn getAuto(this: *const Loader, key: string) string {
+ return this.get(key) orelse key;
+ }
+
/// Load values from the environment into Define.
///
/// If there is a framework, values from the framework are inserted with a