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
This commit is contained in:
Sean M. Collins 2025-03-10 21:49:36 -04:00
parent 359b4fc2eb
commit 9e4e8529c5
2 changed files with 49 additions and 1 deletions

View File

@ -106,7 +106,7 @@ pub fn run(
try copySourceFile( try copySourceFile(
allocator, allocator,
install_dir, install_dir,
"demo/config/database.zig", "demo/config/database_template.zig",
"config/database.zig", "config/database.zig",
null, null,
); );

View File

@ -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",
// },
};