mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 16:26:37 +00:00
Merge pull request #1561 from Infisical/pg-new-connection
add individual pg connection properties
This commit is contained in:
@@ -6,6 +6,13 @@ export const initDbConnection = ({ dbConnectionUri, dbRootCert }: { dbConnection
|
|||||||
client: "pg",
|
client: "pg",
|
||||||
connection: {
|
connection: {
|
||||||
connectionString: dbConnectionUri,
|
connectionString: dbConnectionUri,
|
||||||
|
host: process.env.DB_HOST,
|
||||||
|
// @ts-expect-error I have no clue why only for the port there is a type error
|
||||||
|
// eslint-disable-next-line
|
||||||
|
port: process.env.DB_PORT,
|
||||||
|
user: process.env.DB_USER,
|
||||||
|
database: process.env.DB_NAME,
|
||||||
|
password: process.env.DB_PASSWORD,
|
||||||
ssl: dbRootCert
|
ssl: dbRootCert
|
||||||
? {
|
? {
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
|
|||||||
@@ -7,18 +7,22 @@ import path from "path";
|
|||||||
|
|
||||||
// Update with your config settings. .
|
// Update with your config settings. .
|
||||||
dotenv.config({
|
dotenv.config({
|
||||||
path: path.join(__dirname, "../../../.env.migration"),
|
path: path.join(__dirname, "../../../.env.migration")
|
||||||
debug: true
|
|
||||||
});
|
});
|
||||||
dotenv.config({
|
dotenv.config({
|
||||||
path: path.join(__dirname, "../../../.env"),
|
path: path.join(__dirname, "../../../.env")
|
||||||
debug: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
development: {
|
development: {
|
||||||
client: "postgres",
|
client: "postgres",
|
||||||
connection: {
|
connection: {
|
||||||
connectionString: process.env.DB_CONNECTION_URI,
|
connectionString: process.env.DB_CONNECTION_URI,
|
||||||
|
host: process.env.DB_HOST,
|
||||||
|
port: process.env.DB_PORT,
|
||||||
|
user: process.env.DB_USER,
|
||||||
|
database: process.env.DB_NAME,
|
||||||
|
password: process.env.DB_PASSWORD,
|
||||||
ssl: process.env.DB_ROOT_CERT
|
ssl: process.env.DB_ROOT_CERT
|
||||||
? {
|
? {
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
@@ -41,6 +45,11 @@ export default {
|
|||||||
client: "postgres",
|
client: "postgres",
|
||||||
connection: {
|
connection: {
|
||||||
connectionString: process.env.DB_CONNECTION_URI,
|
connectionString: process.env.DB_CONNECTION_URI,
|
||||||
|
host: process.env.DB_HOST,
|
||||||
|
port: process.env.DB_PORT,
|
||||||
|
user: process.env.DB_USER,
|
||||||
|
database: process.env.DB_NAME,
|
||||||
|
password: process.env.DB_PASSWORD,
|
||||||
ssl: process.env.DB_ROOT_CERT
|
ssl: process.env.DB_ROOT_CERT
|
||||||
? {
|
? {
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
|
|||||||
@@ -15,8 +15,16 @@ const envSchema = z
|
|||||||
PORT: z.coerce.number().default(4000),
|
PORT: z.coerce.number().default(4000),
|
||||||
REDIS_URL: zpStr(z.string()),
|
REDIS_URL: zpStr(z.string()),
|
||||||
HOST: zpStr(z.string().default("localhost")),
|
HOST: zpStr(z.string().default("localhost")),
|
||||||
DB_CONNECTION_URI: zpStr(z.string().describe("Postgres database connection string")),
|
DB_CONNECTION_URI: zpStr(z.string().describe("Postgres database connection string")).default(
|
||||||
|
`postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`
|
||||||
|
),
|
||||||
DB_ROOT_CERT: zpStr(z.string().describe("Postgres database base64-encoded CA cert").optional()),
|
DB_ROOT_CERT: zpStr(z.string().describe("Postgres database base64-encoded CA cert").optional()),
|
||||||
|
DB_HOST: zpStr(z.string().describe("Postgres database host").optional()),
|
||||||
|
DB_PORT: zpStr(z.string().describe("Postgres database port").optional()).default("5432"),
|
||||||
|
DB_USER: zpStr(z.string().describe("Postgres database username").optional()),
|
||||||
|
DB_PASSWORD: zpStr(z.string().describe("Postgres database password").optional()),
|
||||||
|
DB_NAME: zpStr(z.string().describe("Postgres database name").optional()),
|
||||||
|
|
||||||
NODE_ENV: z.enum(["development", "test", "production"]).default("production"),
|
NODE_ENV: z.enum(["development", "test", "production"]).default("production"),
|
||||||
SALT_ROUNDS: z.coerce.number().default(10),
|
SALT_ROUNDS: z.coerce.number().default(10),
|
||||||
INITIAL_ORGANIZATION_NAME: zpStr(z.string().optional()),
|
INITIAL_ORGANIZATION_NAME: zpStr(z.string().optional()),
|
||||||
|
|||||||
Reference in New Issue
Block a user