|
10 | 10 | // Added via Wheels CLI |
11 | 11 | this.name = "starterApp"; |
12 | 12 |
|
| 13 | + // H2 embedded database — boots out of the box with no .env or external |
| 14 | + // database server. The H2 driver (org.h2.Driver) is bundled with Lucee, so |
| 15 | + // it works on a plain `box install` / CommandBox install without any extra |
| 16 | + // JDBC driver. MODE=MySQL gives MySQL-compatible SQL. Data files live under |
| 17 | + // db/h2/. Run `wheels migrate latest` after install to create the schema. |
| 18 | + // |
| 19 | + // To use a server-based database (MySQL/PostgreSQL/etc.) instead, copy |
| 20 | + // .env.example to .env, fill in your credentials, and swap the datasource |
| 21 | + // definition below for one that reads this.env.DB_* (see .env.example for |
| 22 | + // the full set of keys). |
13 | 23 | this.datasources["starterApp"] = { |
14 | | - class: this.env.DB_CLASS, |
15 | | - bundleName: this.env.DB_BUNDLENAME, |
16 | | - bundleVersion: this.env.DB_BUNDLEVERSION, |
17 | | - connectionString: "jdbc:mysql://#this.env.DB_HOST#:#this.env.DB_PORT#/#this.env.DB_NAME#?characterEncoding=UTF-8&serverTimezone=UTC&maxReconnects=3", |
18 | | - username: this.env.DB_USER, |
19 | | - password: "encrypted:#this.env.DB_PASSWORD#", |
20 | | - |
21 | | - // optional settings |
22 | | - connectionLimit: val(this.env.DB_CONNECTIONLIMIT), // default:-1 |
23 | | - liveTimeout: val(this.env.DB_LIVETIMEOUT), // default: -1; unit: minutes |
24 | | - alwaysSetTimeout: this.env.DB_ALWAYSSETTIMEOUT EQ "true", // default: false |
25 | | - validate: this.env.DB_VALIDATE EQ "true" // default: false |
26 | | - |
| 24 | + class: "org.h2.Driver", |
| 25 | + connectionString: "jdbc:h2:file:" & expandPath("../db/h2/starterApp") & ";MODE=MySQL", |
| 26 | + username: "sa" |
| 27 | + }; |
| 28 | +
|
| 29 | + // Test database datasource (used by the app test suite). |
| 30 | + this.datasources["starterApp_test"] = { |
| 31 | + class: "org.h2.Driver", |
| 32 | + connectionString: "jdbc:h2:file:" & expandPath("../db/h2/starterApp_test") & ";MODE=MySQL", |
| 33 | + username: "sa" |
27 | 34 | }; |
28 | 35 |
|
29 | 36 | // buffer the output of a tag/function body to output in case of a exception |
|
0 commit comments