mirror of
https://github.com/movie-web/backend.git
synced 2025-09-13 13:03:26 +00:00
Add ORM Specific config
This commit is contained in:
20
src/config/orm.ts
Normal file
20
src/config/orm.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { createConfigLoader } from 'neat-config';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
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')
|
||||||
|
.addZodSchema(ormConfigSchema)
|
||||||
|
.freeze()
|
||||||
|
.load();
|
@@ -1,4 +1,4 @@
|
|||||||
|
import { ormConf } from '@/config/orm';
|
||||||
import { makeOrmConfig } from '@/modules/mikro/orm';
|
import { makeOrmConfig } from '@/modules/mikro/orm';
|
||||||
import { conf } from '@/config';
|
|
||||||
|
|
||||||
export default makeOrmConfig(conf.postgres.connection);
|
export default makeOrmConfig(ormConf.postgres.connection);
|
||||||
|
Reference in New Issue
Block a user