chore: v0.0.1

This commit is contained in:
karishmas6
2024-10-30 12:04:38 +05:30
parent 8a21a7ac10
commit 76767f602d
7 changed files with 19 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ services:
- redis - redis
db: db:
image: postgres:15 image: postgres:13
environment: environment:
POSTGRES_DB: ${DB_NAME} POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER} POSTGRES_USER: ${DB_USER}

View File

@@ -7,7 +7,7 @@ server {
} }
location /api { location /api {
proxy_pass http://localhost:8080; proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';

View File

@@ -1,4 +1,4 @@
export const SERVER_PORT = process.env.SERVER_PORT ? Number(process.env.SERVER_PORT) : 8080 export const SERVER_PORT = process.env.SERVER_PORT ? Number(process.env.SERVER_PORT) : 8080
export const DEBUG = process.env.DEBUG === 'true' export const DEBUG = process.env.DEBUG === 'true'
export const LOGS_PATH = process.env.LOGS_PATH ?? 'server/logs' export const LOGS_PATH = process.env.LOGS_PATH ?? 'server/logs'
export const ANALYTICS_ID = process.env.ANALYTICS_ID ?? 'oss' export const ANALYTICS_ID = 'oss'

View File

@@ -62,8 +62,13 @@ readdirSync(path.join(__dirname, 'api')).forEach((r) => {
} }
}); });
const workerProcess = fork(path.resolve(__dirname, './worker.ts'), [], { // Check if we're running in production or development
execArgv: ['--inspect=5859'], // Specify a different debug port for the worker const isProduction = process.env.NODE_ENV === 'production';
const workerPath = path.resolve(__dirname, isProduction ? './worker.js' : '/worker.ts');
// Fork the worker process
const workerProcess = fork(workerPath, [], {
execArgv: isProduction ? ['--inspect=8081'] : ['--inspect=5859'],
}); });
workerProcess.on('message', (message) => { workerProcess.on('message', (message) => {

View File

@@ -6,7 +6,7 @@ dotenv.config();
const sequelize = new Sequelize( const sequelize = new Sequelize(
`postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`, `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`,
{ {
host: 'localhost', host: process.env.DB_HOST,
dialect: 'postgres', dialect: 'postgres',
logging: false, logging: false,
} }

View File

@@ -24,9 +24,9 @@ export const comparePassword = (password: string, hash: string): Promise<boolean
} }
export const encrypt = (text: string): string => { export const encrypt = (text: string): string => {
const ivLength = parseInt(getEnvVariable('IV_LENGTH'), 10); const ivLength = 16;
const iv = crypto.randomBytes(ivLength); const iv = crypto.randomBytes(ivLength);
const algorithm = getEnvVariable('ALGORITHM'); const algorithm = 'aes-256-cbc';
const key = Buffer.from(getEnvVariable('ENCRYPTION_KEY'), 'hex'); const key = Buffer.from(getEnvVariable('ENCRYPTION_KEY'), 'hex');
const cipher = crypto.createCipheriv(algorithm, key, iv); const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = cipher.update(text, 'utf8', 'hex'); let encrypted = cipher.update(text, 'utf8', 'hex');

View File

@@ -5,8 +5,13 @@ import { handleRunRecording } from "./workflow-management/scheduler";
import Robot from './models/Robot'; import Robot from './models/Robot';
import { computeNextRun } from './utils/schedule'; import { computeNextRun } from './utils/schedule';
console.log('Environment variables:', {
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
});
const connection = new IORedis({ const connection = new IORedis({
host: process.env.REDIS_HOST ? process.env.REDIS_HOST : 'redis', host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT, 10) : 6379, port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT, 10) : 6379,
maxRetriesPerRequest: null, maxRetriesPerRequest: null,
}); });