refactor(server): move constant into common package (#522)

* refactor(server): move constant into common package

* refactor(server): re-arrange import statement in microservice module

* refactor(server): move app.config into common package

* fix(server): e2e testing
This commit is contained in:
Thanh Pham 2022-08-23 21:34:21 +07:00 committed by GitHub
parent 0efcc99f3e
commit 3b55cdc0be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 72 additions and 40 deletions

View file

@ -0,0 +1,20 @@
import { ConfigModuleOptions } from '@nestjs/config';
import Joi from 'joi';
export const immichAppConfig: ConfigModuleOptions = {
envFilePath: '.env',
isGlobal: true,
validationSchema: Joi.object({
NODE_ENV: Joi.string().required().valid('development', 'production', 'staging').default('development'),
DB_USERNAME: Joi.string().required(),
DB_PASSWORD: Joi.string().required(),
DB_DATABASE_NAME: Joi.string().required(),
JWT_SECRET: Joi.string().required(),
ENABLE_MAPBOX: Joi.boolean().required().valid(true, false),
MAPBOX_KEY: Joi.any().when('ENABLE_MAPBOX', {
is: false,
then: Joi.string().optional().allow(null, ''),
otherwise: Joi.string().required(),
}),
}),
};

View file

@ -0,0 +1 @@
export * from './app.config';

View file

@ -0,0 +1 @@
export * from './upload_location.constant';

View file

@ -0,0 +1 @@
export const APP_UPLOAD_LOCATION = './upload';

View file

@ -0,0 +1,2 @@
export * from './config';
export * from './constants';

View file

@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "../../dist/libs/common"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}