drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: allow to use ssl at dbCredentials with url
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [X] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
For now in typings it union type of definition dbCredentials
```ts
{
dialect: Verify;
dbCredentials: ({
host: string;
port?: number;
user?: string;
password?: string;
database: string;
ssl?: boolean | 'require' | 'allow' | 'prefer' | 'verify-full' | ConnectionOptions;
} & {}) | {
url: string;
};
}
```
I want to use both `url` & `ssl` keys
```ts
import type { Config } from "drizzle-kit"
export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL as string
}
} satisfies Config
```
like in postgres client initialization
```ts
const client = postgres(process.env.DATABASE_URL as string, {
ssl: "require",
});
export const db = drizzle(client);
```
workaround is:
```ts
import type { Config } from "drizzle-kit";
const url = new URL(process.env.DATABASE_URL as string);
if (process.env.USE_SSL) {
url.searchParams.append("sslmode", "require");
url.searchParams.append("ssl", "true");
}
export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
casing: "snake_case",
dbCredentials: {
url: url.toString(),
},
} satisfies Config;
```
Contributor guide
Assessment
This issue has not been assessed yet.