mirror of
https://github.com/movie-web/backend.git
synced 2025-09-13 14:53:25 +00:00
30 lines
708 B
TypeScript
30 lines
708 B
TypeScript
import { devFragment } from '@/config/fragments/dev';
|
|
import { dockerFragment } from '@/config/fragments/docker';
|
|
import { createConfigLoader } from 'neat-config';
|
|
import { z } from 'zod';
|
|
|
|
const fragments = {
|
|
dev: devFragment,
|
|
dockerdev: dockerFragment,
|
|
};
|
|
|
|
export const ormConfigSchema = z.object({
|
|
postgres: z.object({
|
|
// connection URL for postgres database
|
|
connection: z.string(),
|
|
}),
|
|
});
|
|
|
|
export const ormConf = createConfigLoader()
|
|
.addFromEnvironment('MWB_')
|
|
.addFromCLI('mwb-')
|
|
.addFromFile('.env', {
|
|
prefix: 'MWB_',
|
|
})
|
|
.addFromFile('config.json')
|
|
.setFragmentKey('usePresets')
|
|
.addConfigFragments(fragments)
|
|
.addZodSchema(ormConfigSchema)
|
|
.freeze()
|
|
.load();
|