I am using joi to validate my the env variables that I need which works pretty well like:
@Module({
imports: [
ConfigModule.forRoot({
validationSchema: Joi.object({
FOLDER: Joi.string().default("../../tmp"),
LOG_LEVEL: Joi.string()
.valid("trace", "debug", "info", "warn", "error", "fatal")
.default(
process.env.NODE_ENV === "production"
? "warn"
: "debug",
),
CONFIG_IMPORT: Joi.boolean().default(false),
CONFIG_IMPORT_FORCE: Joi.boolean().default(false),
CONFIG_FOLDER: Joi.string().default("../../assets/config"),
...AUTH_VALIDATION_SCHEMA,
LOG_ENABLE_HTTP_LOGGER: Joi.boolean().default(false),
LOG_ENABLE_SESSION_LOGGER: Joi.boolean().default(false),
LOG_DEBUG_MODE: Joi.boolean().default(false),
LOG_FORMAT: Joi.string()
.valid("json", "pretty")
.default(
process.env.NODE_ENV === "production"
? "json"
: "pretty",
),
}),
isGlobal: true,
expandVariables: true,
}),
However it would be really cool to print some description which would it make easier for devs to understand the meaning of a variable (like it can be done with json schemas).
Is there a way when I add my values with Joi.boolean().description("will enable logging") that will print me out the description and also the dependancies (only important when x is equal to y)