feat: Convert ts files to js files for config folder

This commit is contained in:
Faruk AYDIN
2023-12-28 13:09:24 +01:00
parent fd0b12f6a1
commit ca7b8b865a
5 changed files with 4 additions and 65 deletions

View File

@@ -1,6 +1,7 @@
import { URL } from 'node:url';
import * as dotenv from 'dotenv';
import path from 'path';
import process from 'node:process';
if (process.env.APP_ENV === 'test') {
dotenv.config({ path: path.resolve(__dirname, '../../.env.test') });
@@ -8,57 +9,6 @@ if (process.env.APP_ENV === 'test') {
dotenv.config();
}
type AppConfig = {
host: string;
protocol: string;
port: string;
webAppUrl: string;
webhookUrl: string;
appEnv: string;
logLevel: string;
isDev: boolean;
isTest: boolean;
isProd: boolean;
postgresDatabase: string;
postgresSchema: string;
postgresPort: number;
postgresHost: string;
postgresUsername: string;
postgresPassword?: string;
version: string;
postgresEnableSsl: boolean;
baseUrl: string;
encryptionKey: string;
webhookSecretKey: string;
appSecretKey: string;
serveWebAppSeparately: boolean;
redisHost: string;
redisPort: number;
redisUsername: string;
redisPassword: string;
redisTls: boolean;
enableBullMQDashboard: boolean;
bullMQDashboardUsername: string;
bullMQDashboardPassword: string;
telemetryEnabled: boolean;
requestBodySizeLimit: string;
smtpHost: string;
smtpPort: number;
smtpSecure: boolean;
smtpUser: string;
smtpPassword: string;
fromEmail: string;
isCloud: boolean;
isMation: boolean;
isSelfHosted: boolean;
paddleVendorId: number;
paddleVendorAuthCode: string;
paddlePublicKey: string;
licenseKey: string;
sentryDsn: string;
CI: boolean;
};
const host = process.env.HOST || 'localhost';
const protocol = process.env.PROTOCOL || 'http';
const port = process.env.PORT || '3000';
@@ -85,7 +35,7 @@ webhookUrl = webhookUrl.substring(0, webhookUrl.length - 1);
const appEnv = process.env.APP_ENV || 'development';
const appConfig: AppConfig = {
const appConfig = {
host,
protocol,
port,

View File

@@ -4,11 +4,10 @@ import process from 'process';
import pg from 'pg';
pg.types.setTypeParser(20, 'text', parseInt);
import knex from 'knex';
import type { Knex } from 'knex';
import knexConfig from '../../knexfile';
import logger from '../helpers/logger';
export const client: Knex = knex(knexConfig);
export const client = knex(knexConfig);
const CONNECTION_REFUSED = 'ECONNREFUSED';

View File

@@ -1,16 +1,6 @@
import appConfig from './app';
type TRedisConfig = {
host: string,
port: number,
username?: string,
password?: string,
tls?: Record<string, unknown>,
enableReadyCheck?: boolean,
enableOfflineQueue: boolean,
}
const redisConfig: TRedisConfig = {
const redisConfig = {
host: appConfig.redisHost,
port: appConfig.redisPort,
username: appConfig.redisUsername,