@teamkeel/functions-runtime 0.256.0 → 0.258.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ModelAPI.test.js +2 -2
- package/src/database.js +7 -7
- package/src/handleRequest.test.js +2 -2
package/package.json
CHANGED
package/src/ModelAPI.test.js
CHANGED
|
@@ -4,8 +4,8 @@ const { sql } = require("kysely");
|
|
|
4
4
|
const { getDatabase } = require("./database");
|
|
5
5
|
const KSUID = require("ksuid");
|
|
6
6
|
|
|
7
|
-
process.env.
|
|
8
|
-
process.env.
|
|
7
|
+
process.env.KEEL_DB_CONN_TYPE = "pg";
|
|
8
|
+
process.env.KEEL_DB_CONN = `postgresql://postgres:postgres@localhost:5432/functions-runtime`;
|
|
9
9
|
|
|
10
10
|
let personAPI;
|
|
11
11
|
let postAPI;
|
package/src/database.js
CHANGED
|
@@ -12,12 +12,12 @@ function mustEnv(key) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function getDialect() {
|
|
15
|
-
const dbConnType = process.env["
|
|
15
|
+
const dbConnType = process.env["KEEL_DB_CONN_TYPE"];
|
|
16
16
|
switch (dbConnType) {
|
|
17
17
|
case "pg":
|
|
18
18
|
return new PostgresDialect({
|
|
19
19
|
pool: new pg.Pool({
|
|
20
|
-
connectionString: mustEnv("
|
|
20
|
+
connectionString: mustEnv("KEEL_DB_CONN"),
|
|
21
21
|
}),
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -26,16 +26,16 @@ function getDialect() {
|
|
|
26
26
|
mode: "postgres",
|
|
27
27
|
driver: {
|
|
28
28
|
client: new RDSDataService({
|
|
29
|
-
region: mustEnv("
|
|
29
|
+
region: mustEnv("KEEL_DB_REGION"),
|
|
30
30
|
}),
|
|
31
|
-
database: mustEnv("
|
|
32
|
-
secretArn: mustEnv("
|
|
33
|
-
resourceArn: mustEnv("
|
|
31
|
+
database: mustEnv("KEEL_DB_NAME"),
|
|
32
|
+
secretArn: mustEnv("KEEL_DB_SECRET_ARN"),
|
|
33
|
+
resourceArn: mustEnv("KEEL_DB_RESOURCE_ARN"),
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
default:
|
|
38
|
-
throw Error("unexpected
|
|
38
|
+
throw Error("unexpected KEEL_DB_CONN_TYPE: " + dbConnType);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -131,8 +131,8 @@ describe("ModelAPI error handling", () => {
|
|
|
131
131
|
let db;
|
|
132
132
|
|
|
133
133
|
beforeEach(async () => {
|
|
134
|
-
process.env.
|
|
135
|
-
process.env.
|
|
134
|
+
process.env.KEEL_DB_CONN_TYPE = "pg";
|
|
135
|
+
process.env.KEEL_DB_CONN = `postgresql://postgres:postgres@localhost:5432/functions-runtime`;
|
|
136
136
|
|
|
137
137
|
db = getDatabase();
|
|
138
138
|
|