added readme and improved config

This commit is contained in:
2023-03-23 11:59:08 -04:00
parent 8389db4367
commit a6524d7f65
14 changed files with 229 additions and 27 deletions

View File

@@ -1,8 +1,11 @@
export interface CommonConfig {
AUDIT: boolean;
AWS_ACCOUNT_ID: string;
AWS_REGION: string;
DB_DATABASE: string;
DB_LOGGING?: boolean;
DB_SYNCHRONIZE?: boolean;
HOST: string;
PORT: number;
PROTO: string;
}

View File

@@ -0,0 +1,14 @@
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'),
});

View File

@@ -1,11 +1,13 @@
import { CommonConfig } from "./common-config.interface";
export default (): CommonConfig => ({
AWS_ACCOUNT_ID: '000000000000',
AWS_REGION: 'us-east-1',
// DB_DATABASE: ':memory:',
DB_DATABASE: 'local-aws.sqlite',
DB_LOGGING: true,
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: 'http://localhost:8081',
HOST: process.env.HOST,
PROTO: process.env.PROTOCOL,
PORT: Number(process.env.PORT),
});