@xrystal/core 3.6.6 → 3.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.6.6",
4
+ "version": "3.6.8",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -1,13 +1,10 @@
1
1
  import SystemService from '../system/index';
2
2
  export default class ConfigsService {
3
- protected _globalEnvFileName: string;
3
+ private config;
4
4
  protected _systemService: SystemService;
5
- static tmpFolderPath: string;
6
- private _envLoadPath;
7
- load: ({ tmpFolderPath, systemService, envLoadPath, globalEnvFileName }: {
8
- tmpFolderPath: string;
5
+ load: ({ tmp, systemService }: {
6
+ tmp: any;
9
7
  systemService: SystemService;
10
- envLoadPath: string;
11
- globalEnvFileName?: string | null;
12
- }) => any;
8
+ }) => void;
9
+ get all(): Record<string, any>;
13
10
  }
@@ -1,17 +1,19 @@
1
1
  export default class ConfigsService {
2
- _globalEnvFileName = 'global';
2
+ config = {};
3
3
  _systemService;
4
- static tmpFolderPath;
5
- _envLoadPath = '';
6
- load = ({ tmpFolderPath, systemService, envLoadPath, globalEnvFileName }) => {
7
- ConfigsService.tmpFolderPath = tmpFolderPath;
4
+ load = ({ tmp, systemService }) => {
8
5
  this._systemService = systemService;
9
- this._envLoadPath = `${envLoadPath}`;
10
- /*
11
- this._dynamicEnvLoader({
12
- nodeEnv
13
- globalEnvFileName
14
- })
15
- */
6
+ const rawConfigs = tmp?.configs || tmp?.configs || {};
7
+ this.config = {
8
+ rootFolderPath: rawConfigs.rootFolderPath || 'x',
9
+ projectName: tmp.project.name,
10
+ port: process.env.PORT || rawConfigs.port || 3000,
11
+ serviceName: rawConfigs.service,
12
+ env: process.env.NODE_ENV,
13
+ ...rawConfigs
14
+ };
16
15
  };
16
+ get all() {
17
+ return this.config;
18
+ }
17
19
  }
@@ -33,9 +33,8 @@ const coreLoader = async () => {
33
33
  tmp: { _: r }
34
34
  });
35
35
  await configService.load({
36
- tmpFolderPath: rootFolderPath,
36
+ tmp: r,
37
37
  systemService: system,
38
- envLoadPath: path.join(rootFolderPath, configs.loaders.configs.envLoadPath),
39
38
  ...(configs.loaders.configs.globalEnvFileName && { globalEnvFileName: configs.loaders.configs.globalEnvFileName })
40
39
  });
41
40
  await logger.load({