feat: add backend-mock app
This commit is contained in:
23
apps/backend-mock/src/config/index.ts
Normal file
23
apps/backend-mock/src/config/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as yaml from 'js-yaml';
|
||||
|
||||
const configFileNameObj = {
|
||||
development: 'dev',
|
||||
production: 'prod',
|
||||
};
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
|
||||
const configFactory = () => {
|
||||
return yaml.load(
|
||||
readFileSync(
|
||||
join(process.cwd(), 'src', 'config', `${configFileNameObj[env]}.yml`),
|
||||
'utf8',
|
||||
),
|
||||
) as Record<string, any>;
|
||||
};
|
||||
|
||||
export default configFactory;
|
||||
Reference in New Issue
Block a user