From e8272efd9f71ad27a0e62b6b3fa3d13e99a6736f Mon Sep 17 00:00:00 2001 From: T Date: Mon, 25 May 2026 12:19:50 -0700 Subject: work --- libawl/src/config.zig | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 libawl/src/config.zig (limited to 'libawl/src/config.zig') diff --git a/libawl/src/config.zig b/libawl/src/config.zig deleted file mode 100644 index 8b6f147..0000000 --- a/libawl/src/config.zig +++ /dev/null @@ -1,37 +0,0 @@ -const std = @import("std"); - -pub const Config = struct { - api_key: []const u8, - base_url: []const u8, - model: []const u8, - - pub const Error = error{MissingApiKey}; - - pub fn fromEnv() Error!Config { - const api_key_z = std.c.getenv("PANTO_API_KEY") orelse return Error.MissingApiKey; - const api_key = std.mem.sliceTo(api_key_z, 0); - - const base_url_z = std.c.getenv("PANTO_BASE_URL") orelse "https://api.openai.com/v1"; - const base_url = std.mem.sliceTo(base_url_z, 0); - - const model_z = std.c.getenv("PANTO_MODEL") orelse "gpt-4o"; - const model = std.mem.sliceTo(model_z, 0); - - return Config{ - .api_key = api_key, - .base_url = base_url, - .model = model, - }; - } -}; - -test "Config - defaults" { - const cfg = Config{ - .api_key = "test-key", - .base_url = "https://api.openai.com/v1", - .model = "gpt-4o", - }; - try std.testing.expectEqualStrings("test-key", cfg.api_key); - try std.testing.expectEqualStrings("https://api.openai.com/v1", cfg.base_url); - try std.testing.expectEqualStrings("gpt-4o", cfg.model); -} -- cgit v1.3