feat(nested config files)

Adds a config_files option to config.json that allows the user
to specify one or more config files to load in addition to the
main config file.

For me this allows me to keep my flow configuration in a shared dotfiles
repository managed by git.
This commit is contained in:
Jonathan Marler 2025-01-06 02:02:05 -07:00 committed by CJ van den Berg
parent a6b29e4fe9
commit 194fe70d6e
3 changed files with 67 additions and 3 deletions

View file

@ -393,6 +393,9 @@ const config = @import("config");
pub fn read_config(allocator: std.mem.Allocator, buf: *?[]const u8) config {
const file_name = get_app_config_file_name(application_name) catch return .{};
return read_config_at(allocator, buf, file_name);
}
pub fn read_config_at(allocator: std.mem.Allocator, buf: *?[]const u8, file_name: []const u8) config {
return read_json_config_file(allocator, file_name, buf) catch |e| {
log.logger("config").print_err("read_config", "error reading config file: {any}", .{e});
return .{};