@xrystal/core 3.18.6 → 3.18.7

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.18.6",
4
+ "version": "3.18.7",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -33,7 +33,7 @@ export default class ConfigsService implements IService {
33
33
  constructor({ systemService }: {
34
34
  systemService: SystemService;
35
35
  });
36
- load: ({}: {}) => void;
36
+ load: ({}: {}) => Promise<void>;
37
37
  setConfig(newConfigs: any): void;
38
38
  get all(): IConfig;
39
39
  }
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { Constants } from '../../utils';
3
+ import { pathToFileURL } from 'node:url';
3
4
  export default class ConfigsService {
4
5
  config;
5
6
  publicFolderName = Constants.publicFolderName;
@@ -8,9 +9,19 @@ export default class ConfigsService {
8
9
  constructor({ systemService }) {
9
10
  this.#systemService = systemService;
10
11
  }
11
- load = ({}) => {
12
+ load = async ({}) => {
12
13
  const tmp = this.#systemService.tmp;
13
- const rawConfigs = tmp?.configs || tmp?.configs || {};
14
+ const extendConfigs = tmp.configs.loaders.configs.loadPath;
15
+ let importedModule;
16
+ const cwd = process.cwd();
17
+ if (extendConfigs.startsWith('@/')) {
18
+ const fullPath = path.join(cwd, extendConfigs.slice(2));
19
+ importedModule = await import(pathToFileURL(fullPath).href);
20
+ }
21
+ else {
22
+ const fullPath = path.resolve(tmp.configs.rootFolderPath, extendConfigs);
23
+ importedModule = await import(pathToFileURL(fullPath).href);
24
+ }
14
25
  this.config = {
15
26
  worker: process.env.WORKER === 'true' ? true : false || false,
16
27
  nodeEnv: process.env.NODE_ENV,
@@ -19,22 +30,23 @@ export default class ConfigsService {
19
30
  httpsfileEncoding: process.env.ENCODING || 'utf8',
20
31
  httpsCertfile: process.env.HTTPS_CERT_FILE,
21
32
  httpsKeyfile: process.env.HTTPS_KEY_FILE,
22
- rootFolderPath: rawConfigs.rootFolderPath || 'x',
33
+ rootFolderPath: tmp.configs.rootFolderPath || 'x',
23
34
  projectName: tmp.project.name,
24
- serviceName: rawConfigs.service,
35
+ serviceName: tmp.configs.service,
25
36
  projectNamePrefixEnv: process.env.PROJECT_NAME_PREFIX || '',
26
37
  projectNameEnv: process.env.PROJECT_NAME || '',
27
38
  projectNameSuffixEnv: process.env.PROJECT_NAME_SUFFIX || '',
28
- systemStaticFolderPath: path.resolve(rawConfigs.rootFolderPath, this.publicFolderName),
39
+ systemStaticFolderPath: path.resolve(tmp.configs.rootFolderPath, this.publicFolderName),
29
40
  systemLoggerLayer: process.env.SYSTEM_LOGGER_LAYER,
30
41
  kafkaBrokers: process.env?.KAFKA_BROKERS,
31
42
  kafkaLogsTopic: this.kafkaLogsTopic,
32
43
  baseApiUri: process.env.HTTPS === 'true' ? process.env.SYSTEM_HTTPS_BASE_API_URI : process.env.SYSTEM_BASE_API_URI,
33
- port: process.env.PORT || rawConfigs.port || 3000,
44
+ port: Number(process.env.PORT),
34
45
  internalSecret: process.env.INTERNAL_SECRET,
35
46
  secret: process.env.SECRET,
36
- cwd: process.cwd(),
37
- env: process.env.NODE_ENV
47
+ cwd,
48
+ env: process.env.NODE_ENV,
49
+ ...importedModule.configs,
38
50
  };
39
51
  };
40
52
  setConfig(newConfigs) {
@@ -0,0 +1 @@
1
+ export declare const configs: {};
@@ -0,0 +1 @@
1
+ export const configs = {};
package/x/tmp.yml CHANGED
@@ -7,7 +7,7 @@ configs:
7
7
 
8
8
  loaders:
9
9
  configs:
10
- envLoadPath: environments
10
+ loadPath: '@/source/utils/models/classes/configs.project.ts'
11
11
 
12
12
  loggers:
13
13
  loadPath: logs