4.6.5- CoreferenceResolution Module (#631)
This commit is contained in:
25
projects/app/src/service/common/system/index.ts
Normal file
25
projects/app/src/service/common/system/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
|
||||
export const readConfigData = (name: string) => {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const splitName = name.split('.');
|
||||
const devName = `${splitName[0]}.local.${splitName[1]}`;
|
||||
|
||||
const filename = (() => {
|
||||
if (isDev) {
|
||||
// check local file exists
|
||||
const hasLocalFile = existsSync(`data/${devName}`);
|
||||
if (hasLocalFile) {
|
||||
return `data/${devName}`;
|
||||
}
|
||||
return `data/${name}`;
|
||||
}
|
||||
// production path
|
||||
return `/app/data/${name}`;
|
||||
})();
|
||||
|
||||
const content = readFileSync(filename, 'utf-8');
|
||||
|
||||
return content;
|
||||
};
|
||||
Reference in New Issue
Block a user