tego 1.3.54-alpha.5 → 1.3.54-alpha.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/lib/constants.js CHANGED
@@ -38,13 +38,16 @@ module.exports = __toCommonJS(constants_exports);
38
38
  var import_node_fs = __toESM(require("node:fs"));
39
39
  var import_node_path = __toESM(require("node:path"));
40
40
  var import_globals = __toESM(require("@tachybase/globals"));
41
+ var import_lodash = __toESM(require("lodash"));
41
42
  var import_utils = require("./utils");
42
43
  (0, import_utils.parseEnvironment)();
43
44
  if (!import_node_fs.default.existsSync(`${process.env.TEGO_RUNTIME_HOME}/settings.js`)) {
44
45
  import_node_fs.default.mkdirSync(`${process.env.TEGO_RUNTIME_HOME}`, { recursive: true });
45
46
  import_node_fs.default.copyFileSync(import_node_path.default.join(__dirname, "../presets/settings.js"), `${process.env.TEGO_RUNTIME_HOME}/settings.js`);
46
47
  }
47
- import_globals.default.settings = require(`${process.env.TEGO_RUNTIME_HOME}/settings.js`);
48
+ const baseSettings = require(`${process.env.TEGO_RUNTIME_HOME}/settings.js`);
49
+ const envSettings = (0, import_utils.convertEnvToSettings)(process.env);
50
+ import_globals.default.settings = import_lodash.default.merge({}, baseSettings, envSettings);
48
51
  for (const key in import_globals.default.settings.env) {
49
52
  if (!process.env[key]) {
50
53
  process.env[key] = import_globals.default.settings.env[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tego",
3
- "version": "1.3.54-alpha.5",
3
+ "version": "1.3.54-alpha.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "tego",
@@ -49,21 +49,21 @@
49
49
  "umzug": "3.8.2",
50
50
  "winston": "3.17.0",
51
51
  "winston-daily-rotate-file": "^5.0.0",
52
- "@tachybase/actions": "1.3.54-alpha.5",
53
- "@tachybase/acl": "1.3.54-alpha.5",
54
- "@tachybase/cache": "1.3.54-alpha.5",
55
- "@tachybase/data-source": "1.3.54-alpha.5",
56
- "@tachybase/auth": "1.3.54-alpha.5",
57
- "@tachybase/database": "1.3.54-alpha.5",
58
- "@tachybase/evaluators": "1.3.54-alpha.5",
59
- "@tachybase/globals": "1.3.54-alpha.5",
60
- "@tachybase/logger": "1.3.54-alpha.5",
61
- "@tachybase/loader": "1.3.54-alpha.5",
62
- "@tachybase/resourcer": "1.3.54-alpha.5",
63
- "@tachybase/schema": "1.3.54-alpha.5",
64
- "@tachybase/utils": "1.3.54-alpha.5",
65
- "@tego/server": "1.3.54-alpha.5",
66
- "@tego/core": "1.3.54-alpha.5"
52
+ "@tachybase/acl": "1.3.54-alpha.7",
53
+ "@tachybase/actions": "1.3.54-alpha.7",
54
+ "@tachybase/cache": "1.3.54-alpha.7",
55
+ "@tachybase/auth": "1.3.54-alpha.7",
56
+ "@tachybase/database": "1.3.54-alpha.7",
57
+ "@tachybase/data-source": "1.3.54-alpha.7",
58
+ "@tachybase/evaluators": "1.3.54-alpha.7",
59
+ "@tachybase/globals": "1.3.54-alpha.7",
60
+ "@tachybase/loader": "1.3.54-alpha.7",
61
+ "@tachybase/logger": "1.3.54-alpha.7",
62
+ "@tachybase/resourcer": "1.3.54-alpha.7",
63
+ "@tego/core": "1.3.54-alpha.7",
64
+ "@tachybase/schema": "1.3.54-alpha.7",
65
+ "@tachybase/utils": "1.3.54-alpha.7",
66
+ "@tego/server": "1.3.54-alpha.7"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/lodash": "4.17.20",
package/src/constants.ts CHANGED
@@ -2,7 +2,9 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import TachybaseGlobal from '@tachybase/globals';
4
4
 
5
- import { parseEnvironment } from './utils';
5
+ import _ from 'lodash';
6
+
7
+ import { convertEnvToSettings, parseEnvironment } from './utils';
6
8
 
7
9
  // 解析环境变量
8
10
  parseEnvironment();
@@ -12,7 +14,11 @@ if (!fs.existsSync(`${process.env.TEGO_RUNTIME_HOME}/settings.js`)) {
12
14
  fs.mkdirSync(`${process.env.TEGO_RUNTIME_HOME}`, { recursive: true });
13
15
  fs.copyFileSync(path.join(__dirname, '../presets/settings.js'), `${process.env.TEGO_RUNTIME_HOME}/settings.js`);
14
16
  }
15
- TachybaseGlobal.settings = require(`${process.env.TEGO_RUNTIME_HOME}/settings.js`);
17
+ const baseSettings = require(`${process.env.TEGO_RUNTIME_HOME}/settings.js`);
18
+
19
+ // 用环境变量覆盖 settings.js 的配置 (环境变量优先)
20
+ const envSettings = convertEnvToSettings(process.env as any);
21
+ TachybaseGlobal.settings = _.merge({}, baseSettings, envSettings);
16
22
 
17
23
  for (const key in TachybaseGlobal.settings.env) {
18
24
  if (!process.env[key]) {