From 9e4e8529c5d759b663afb7f4e0a10634fbc24b78 Mon Sep 17 00:00:00 2001 From: "Sean M. Collins" Date: Mon, 10 Mar 2025 21:49:36 -0400 Subject: [PATCH] Create a template file for init This allows us to use database.zig for CI, while still creating a blank database.zig for new projects that are created via jetzig init --- cli/commands/init.zig | 2 +- demo/config/database_template.zig | 48 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 demo/config/database_template.zig diff --git a/cli/commands/init.zig b/cli/commands/init.zig index 42ae81e..934a3fe 100644 --- a/cli/commands/init.zig +++ b/cli/commands/init.zig @@ -106,7 +106,7 @@ pub fn run( try copySourceFile( allocator, install_dir, - "demo/config/database.zig", + "demo/config/database_template.zig", "config/database.zig", null, ); diff --git a/demo/config/database_template.zig b/demo/config/database_template.zig new file mode 100644 index 0000000..676b606 --- /dev/null +++ b/demo/config/database_template.zig @@ -0,0 +1,48 @@ +pub const database = .{ + // Null adapter fails when a database call is invoked. + .development = .{ + .adapter = .null, + }, + .testing = .{ + .adapter = .null, + }, + .production = .{ + .adapter = .null, + }, + // PostgreSQL adapter configuration. + // + // All options except `adapter` can be configured using environment variables: + // + // * JETQUERY_HOSTNAME + // * JETQUERY_PORT + // * JETQUERY_USERNAME + // * JETQUERY_PASSWORD + // * JETQUERY_DATABASE + // + // .testing = .{ + // .adapter = .postgresql, + // .hostname = "localhost", + // .port = 5432, + // .username = "postgres", + // .password = "password", + // .database = "myapp_testing", + // }, + // + // .development = .{ + // .adapter = .postgresql, + // .hostname = "localhost", + // .port = 5432, + // .username = "postgres", + // .password = "password", + // .database = "myapp_development", + // }, + // + // .production = .{ + // .adapter = .postgresql, + // .hostname = "localhost", + // .port = 5432, + // .username = "postgres", + // .password = "password", + // .database = "myapp_production", + // }, +};