Skip to content

Commit

Permalink
chore: update environment.ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
Intellicode committed Jan 17, 2025
1 parent 6da80e9 commit 9cbe6ae
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/migrations/src/scripts/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const PostgresModel = zod.object({
POSTGRES_PORT: NumberFromString,
POSTGRES_DB: zod.string(),
POSTGRES_USER: zod.string(),
POSTGRES_PASSWORD: zod.string(),
POSTGRES_PASSWORD: emptyString(zod.string().optional()),
});

const configs = {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/rate-limit/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const PostgresModel = zod.object({
POSTGRES_PORT: NumberFromString,
POSTGRES_DB: zod.string(),
POSTGRES_USER: zod.string(),
POSTGRES_PASSWORD: zod.string(),
POSTGRES_PASSWORD: emptyString(zod.string().optional()),
});

const PrometheusModel = zod.object({
Expand Down
2 changes: 1 addition & 1 deletion packages/services/server/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const PostgresModel = zod.object({
POSTGRES_PORT: NumberFromString,
POSTGRES_DB: zod.string(),
POSTGRES_USER: zod.string(),
POSTGRES_PASSWORD: zod.string(),
POSTGRES_PASSWORD: emptyString(zod.string().optional()),
});

const ClickHouseModel = zod.object({
Expand Down
6 changes: 3 additions & 3 deletions packages/services/storage/src/db/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { sql } from 'slonik';
export function createConnectionString(config: {
host: string;
port: number;
password: string;
password: string | undefined;
user: string;
db: string;
ssl: boolean;
}) {
// prettier-ignore
const encodedUser = encodeURIComponent(config.user);
const encodedPassword = typeof config.password === 'string' ? `:${encodeURIComponent(config.password)}` : '';
const encodedPassword =
typeof config.password === 'string' ? `:${encodeURIComponent(config.password)}` : '';
const encodedHost = encodeURIComponent(config.host);
const encodedDb = encodeURIComponent(config.db);

return `postgres://${encodedUser}${encodedPassword}@${encodedHost}:${config.port}/${encodedDb}${config.ssl ? '?sslmode=require' : '?sslmode=disable'}`;
}


export function objectToParams<T extends Record<string, any>>(
obj: T,
transformArray?: <K extends keyof T>(key: K, value: T[K]) => any,
Expand Down
2 changes: 1 addition & 1 deletion packages/services/stripe-billing/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const SentryModel = zod.union([
const PostgresModel = zod.object({
POSTGRES_HOST: zod.string(),
POSTGRES_PORT: NumberFromString,
POSTGRES_PASSWORD: zod.string(),
POSTGRES_PASSWORD: emptyString(zod.string().optional()),
POSTGRES_USER: zod.string(),
POSTGRES_DB: zod.string(),
POSTGRES_SSL: emptyString(zod.union([zod.literal('1'), zod.literal('0')]).optional()),
Expand Down
2 changes: 1 addition & 1 deletion packages/services/tokens/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SentryModel = zod.union([
const PostgresModel = zod.object({
POSTGRES_HOST: zod.string(),
POSTGRES_PORT: NumberFromString,
POSTGRES_PASSWORD: zod.string(),
POSTGRES_PASSWORD: emptyString(zod.string().optional()),
POSTGRES_USER: zod.string(),
POSTGRES_DB: zod.string(),
POSTGRES_SSL: emptyString(zod.union([zod.literal('1'), zod.literal('0')]).optional()),
Expand Down

0 comments on commit 9cbe6ae

Please sign in to comment.