This repository has been archived on 2025-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
insiemesalute-3p-nx/apps/ebitemp-api/src/modules/config/local.config.ts

20 lines
534 B
TypeScript

import coerceRecordTypes from './utils/coerce-record-types';
import { registerAs } from '@nestjs/config';
import { z } from 'zod';
export const localSchema = z.object({
production: z.boolean(),
port: z.number().optional(),
});
export type LocalConfig = z.infer<typeof localSchema>;
export const localConfig = registerAs('local', () => {
const env = coerceRecordTypes(process.env);
const config: LocalConfig = localSchema.strict().parse({
production: env['PRODUCTION'],
port: env['PORT'],
});
return config;
});