summaryrefslogtreecommitdiff
path: root/src/config_file.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-13 12:09:00 -0600
committert <t@tjp.lol>2026-06-15 15:08:32 -0600
commit73324a15aa524cf75deebc4172f5a1f0d0051bc6 (patch)
tree85c49f695b3cc5e2b3bbce63e9408ca3ff9b3cf3 /src/config_file.zig
parent1b5917e9eb309b4b78e8d2b88b66e7f7bc1834ef (diff)
auth: CLI auth manager + `panto auth` subcommands
Add src/auth_manager.zig (turn-time resolution: load→login→refresh→exchange→ build credential, patch live config) and `panto auth status|login|logout` subcommands with a line-based device-code presenter. Add config_file.loadFromString.
Diffstat (limited to 'src/config_file.zig')
-rw-r--r--src/config_file.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/config_file.zig b/src/config_file.zig
index 19e4bb1..1277661 100644
--- a/src/config_file.zig
+++ b/src/config_file.zig
@@ -398,6 +398,18 @@ pub fn userConfigPath(allocator: Allocator, environ_map: *const std.process.Envi
return error.NoHomeDirectory;
}
+/// Resolve a `Config` from a single in-memory TOML string. Convenience for
+/// tests and tooling that already hold the document text.
+pub fn loadFromString(
+ allocator: Allocator,
+ environ_map: *const std.process.Environ.Map,
+ source: []const u8,
+) Error!Config {
+ const doc = parseDoc(allocator, source) catch return error.InvalidConfigToml;
+ defer doc.deinit();
+ return resolve(allocator, environ_map, doc.root);
+}
+
/// Load from explicit layer paths, lowest precedence first. Useful for
/// tests. Missing files are skipped.
pub fn loadFromPaths(