added readme and improved config
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
14
src/config/config.validator.ts
Normal file
14
src/config/config.validator.ts
Normal 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'),
|
||||
});
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user