simplify production database configuration
This commit is contained in:
@@ -12,14 +12,25 @@ describe("PostgreSQL script configuration", () => {
|
||||
expect(getScriptDataBackend({ NODE_ENV: "test", ZHINIAN_DATA_BACKEND: "postgres" })).toBe("postgres");
|
||||
});
|
||||
|
||||
it("rejects connection-string SSL options that could override the verified CA configuration", () => {
|
||||
it("accepts SSL settings in the single DATABASE_URL value", async () => {
|
||||
const pool = createPostgresPool({
|
||||
env: {
|
||||
NODE_ENV: "test",
|
||||
ZHINIAN_DATA_BACKEND: "postgres",
|
||||
DATABASE_URL: "postgresql://app:secret@rds.example:5432/app?sslmode=verify-full"
|
||||
}
|
||||
});
|
||||
await pool.end();
|
||||
});
|
||||
|
||||
it("rejects unsupported connection-string SSL options", () => {
|
||||
expect(() => createPostgresPool({
|
||||
env: {
|
||||
NODE_ENV: "test",
|
||||
ZHINIAN_DATA_BACKEND: "postgres",
|
||||
DATABASE_URL: "postgresql://app:secret@rds.example:5432/app?sslmode=no-verify"
|
||||
DATABASE_URL: "postgresql://app:secret@rds.example:5432/app?sslcert=unexpected"
|
||||
}
|
||||
})).toThrow("must not contain SSL query parameters");
|
||||
})).toThrow("unsupported SSL query parameters");
|
||||
});
|
||||
|
||||
it("quotes PostgreSQL role identifiers without allowing SQL syntax injection", () => {
|
||||
|
||||
Reference in New Issue
Block a user