Queue bug fixes

This commit is contained in:
2023-03-29 11:04:57 -04:00
parent a6524d7f65
commit 2c78be1b3f
14 changed files with 450 additions and 59 deletions

View File

@@ -1,5 +1,4 @@
export interface CommonConfig {
AUDIT: boolean;
AWS_ACCOUNT_ID: string;
AWS_REGION: string;
DB_DATABASE: string;

View File

@@ -2,13 +2,12 @@ import * as Joi from 'joi';
import { CommonConfig } from './common-config.interface';
export const configValidator = Joi.object<CommonConfig, true>({
AUDIT: Joi.boolean().default(false),
AWS_ACCOUNT_ID: Joi.string().default('000000000000'),
AWS_REGION: Joi.string().default('us-east-1'),
DB_DATABASE: Joi.string().default(':memory:'),
DB_LOGGING: Joi.boolean().default(false),
DB_SYNCHRONIZE: Joi.boolean().default(true),
HOST: Joi.string().default('localhost'),
PORT: Joi.number().default(8081),
PROTO: Joi.string().valid('http', 'https').default('http'),
AWS_ACCOUNT_ID: Joi.string().required(),
AWS_REGION: Joi.string().required(),
DB_DATABASE: Joi.string().required(),
DB_LOGGING: Joi.boolean().required(),
DB_SYNCHRONIZE: Joi.boolean().valid(true).required(),
HOST: Joi.string().required(),
PORT: Joi.number().required(),
PROTO: Joi.string().valid('http', 'https').required(),
});

View File

@@ -1,13 +1,22 @@
import { CommonConfig } from "./common-config.interface";
import { configValidator } from './config.validator';
export default (): CommonConfig => ({
AUDIT: process.env.DEBUG ? true : false,
AWS_ACCOUNT_ID: process.env.AWS_ACCOUNT_ID,
AWS_REGION: process.env.AWS_REGION,
DB_DATABASE: process.env.PERSISTANCE,
DB_LOGGING: process.env.DEBUG ? true : false,
DB_SYNCHRONIZE: true,
HOST: process.env.HOST,
PROTO: process.env.PROTOCOL,
PORT: Number(process.env.PORT),
});
export default (): CommonConfig => {
const { error, value } = configValidator.validate({
AWS_ACCOUNT_ID: process.env.AWS_ACCOUNT_ID ?? '000000000000',
AWS_REGION: process.env.AWS_REGION ?? 'us-east-1',
DB_DATABASE: process.env.PERSISTANCE ?? ':memory:',
DB_LOGGING: process.env.DEBUG ? true : false,
DB_SYNCHRONIZE: true,
HOST: process.env.HOST ?? 'localhost',
PROTO: process.env.PROTOCOL ?? 'http',
PORT: process.env.PORT as any ?? 8081,
}, { abortEarly: false });
if (error) {
throw error;
}
return value;
}