Files
rg-website-cms/config/database.ts

35 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

2025-08-07 12:00:15 -06:00
export default ({ env }) => {
2025-08-08 13:45:12 -06:00
const client = env('DATABASE_CLIENT', 'postgres');
2025-08-07 12:00:15 -06:00
const connections = {
postgres: {
connection: {
connectionString: env('DATABASE_URL'),
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
2025-08-08 13:45:12 -06:00
database: env('DATABASE_NAME', 'rg-website-cms'),
2025-08-07 12:00:15 -06:00
user: env('DATABASE_USERNAME', 'strapi'),
2025-08-08 13:45:12 -06:00
password: env('DATABASE_PASSWORD', 'strapi_password'),
2025-08-07 12:00:15 -06:00
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
},
schema: env('DATABASE_SCHEMA', 'public'),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
2025-08-08 13:45:12 -06:00
}
2025-08-07 12:00:15 -06:00
};
return {
connection: {
client,
...connections[client],
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
},
};
};