mirror of
https://github.com/p-stream/backend.git
synced 2026-03-11 17:55:35 +00:00
Add ORM Specific config
This commit is contained in:
parent
b1a79242aa
commit
ae0ffa9894
2 changed files with 22 additions and 2 deletions
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 { conf } from '@/config';
|
||||
|
||||
export default makeOrmConfig(conf.postgres.connection);
|
||||
export default makeOrmConfig(ormConf.postgres.connection);
|
||||
|
|
|
|||
Loading…
Reference in a new issue