change --cache-dir -> --http-cache-dir

This commit is contained in:
Muki Kiboigo
2026-04-03 07:21:17 -07:00
parent a71ff521aa
commit ca5fa2b866
2 changed files with 8 additions and 8 deletions

View File

@@ -156,9 +156,9 @@ pub fn userAgentSuffix(self: *const Config) ?[]const u8 {
}; };
} }
pub fn cacheDir(self: *const Config) ?[]const u8 { pub fn httpCacheDir(self: *const Config) ?[]const u8 {
return switch (self.mode) { return switch (self.mode) {
inline .serve, .fetch, .mcp => |opts| opts.common.cache_dir, inline .serve, .fetch, .mcp => |opts| opts.common.http_cache_dir,
else => null, else => null,
}; };
} }
@@ -280,7 +280,7 @@ pub const Common = struct {
log_format: ?log.Format = null, log_format: ?log.Format = null,
log_filter_scopes: ?[]log.Scope = null, log_filter_scopes: ?[]log.Scope = null,
user_agent_suffix: ?[]const u8 = null, user_agent_suffix: ?[]const u8 = null,
cache_dir: ?[]const u8 = null, http_cache_dir: ?[]const u8 = null,
web_bot_auth_key_file: ?[]const u8 = null, web_bot_auth_key_file: ?[]const u8 = null,
web_bot_auth_keyid: ?[]const u8 = null, web_bot_auth_keyid: ?[]const u8 = null,
@@ -401,7 +401,7 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void {
\\--web-bot-auth-domain \\--web-bot-auth-domain
\\ Your domain e.g. yourdomain.com \\ Your domain e.g. yourdomain.com
\\ \\
\\--cache-dir \\--http-cache-dir
\\ Path to a directory to use as a Filesystem Cache for network resources. \\ Path to a directory to use as a Filesystem Cache for network resources.
\\ Omitting this will result is no caching. \\ Omitting this will result is no caching.
\\ Defaults to no caching. \\ Defaults to no caching.
@@ -1079,12 +1079,12 @@ fn parseCommonArg(
return true; return true;
} }
if (std.mem.eql(u8, "--cache-dir", opt)) { if (std.mem.eql(u8, "--http-cache-dir", opt)) {
const str = args.next() orelse { const str = args.next() orelse {
log.fatal(.app, "missing argument value", .{ .arg = "--cache-dir" }); log.fatal(.app, "missing argument value", .{ .arg = "--http-cache-dir" });
return error.InvalidArgument; return error.InvalidArgument;
}; };
common.cache_dir = try allocator.dupe(u8, str); common.http_cache_dir = try allocator.dupe(u8, str);
return true; return true;
} }

View File

@@ -240,7 +240,7 @@ pub fn init(allocator: Allocator, app: *App, config: *const Config) !Network {
else else
null; null;
const cache = if (config.cacheDir()) |cache_dir_path| const cache = if (config.httpCacheDir()) |cache_dir_path|
Cache{ Cache{
.kind = .{ .kind = .{
.fs = FsCache.init(cache_dir_path) catch |e| { .fs = FsCache.init(cache_dir_path) catch |e| {