2022-02-03 10:06:44 -06:00
|
|
|
import { ConfigModuleOptions } from '@nestjs/config';
|
|
|
|
|
import Joi from 'joi';
|
|
|
|
|
|
2023-01-20 20:27:01 +00:00
|
|
|
const WHEN_DB_URL_SET = Joi.when('DB_URL', {
|
|
|
|
|
is: Joi.exist(),
|
|
|
|
|
then: Joi.string().optional(),
|
|
|
|
|
otherwise: Joi.string().required(),
|
|
|
|
|
});
|
|
|
|
|
|
2022-02-03 10:06:44 -06:00
|
|
|
export const immichAppConfig: ConfigModuleOptions = {
|
|
|
|
|
envFilePath: '.env',
|
|
|
|
|
isGlobal: true,
|
|
|
|
|
validationSchema: Joi.object({
|
|
|
|
|
NODE_ENV: Joi.string().required().valid('development', 'production', 'staging').default('development'),
|
2023-01-20 20:27:01 +00:00
|
|
|
DB_USERNAME: WHEN_DB_URL_SET,
|
|
|
|
|
DB_PASSWORD: WHEN_DB_URL_SET,
|
|
|
|
|
DB_DATABASE_NAME: WHEN_DB_URL_SET,
|
|
|
|
|
DB_URL: Joi.string().optional(),
|
2023-03-02 21:47:08 -05:00
|
|
|
TYPESENSE_API_KEY: Joi.when('TYPESENSE_ENABLED', {
|
|
|
|
|
is: 'false',
|
|
|
|
|
then: Joi.string().optional(),
|
|
|
|
|
otherwise: Joi.string().required(),
|
|
|
|
|
}),
|
2022-09-23 03:50:05 +01:00
|
|
|
DISABLE_REVERSE_GEOCODING: Joi.boolean().optional().valid(true, false).default(false),
|
2022-10-23 16:54:54 -05:00
|
|
|
REVERSE_GEOCODING_PRECISION: Joi.number().optional().valid(0, 1, 2, 3).default(3),
|
2023-01-13 09:23:12 -05:00
|
|
|
LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose', 'debug', 'log', 'warn', 'error').default('log'),
|
2023-01-24 06:18:35 +02:00
|
|
|
MACHINE_LEARNING_PORT: Joi.number().optional(),
|
|
|
|
|
MICROSERVICES_PORT: Joi.number().optional(),
|
|
|
|
|
SERVER_PORT: Joi.number().optional(),
|
2022-02-03 10:06:44 -06:00
|
|
|
}),
|
|
|
|
|
};
|