@nocobase/plugin-environment-variables 2.4.0-alpha.4 → 2.4.0-alpha.6
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/dist/externalVersion.js +6 -6
- package/dist/server/plugin.js +9 -7
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/flow-engine": "2.4.0-alpha.
|
|
12
|
-
"@nocobase/client": "2.4.0-alpha.
|
|
11
|
+
"@nocobase/flow-engine": "2.4.0-alpha.6",
|
|
12
|
+
"@nocobase/client": "2.4.0-alpha.6",
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"@nocobase/client-v2": "2.4.0-alpha.
|
|
15
|
-
"@nocobase/database": "2.4.0-alpha.
|
|
16
|
-
"@nocobase/server": "2.4.0-alpha.
|
|
14
|
+
"@nocobase/client-v2": "2.4.0-alpha.6",
|
|
15
|
+
"@nocobase/database": "2.4.0-alpha.6",
|
|
16
|
+
"@nocobase/server": "2.4.0-alpha.6",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
18
|
"@formily/antd-v5": "1.2.3",
|
|
19
19
|
"@formily/core": "2.3.7",
|
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
|
22
22
|
"antd": "5.24.2",
|
|
23
23
|
"react-i18next": "11.18.6",
|
|
24
24
|
"@emotion/css": "11.13.0",
|
|
25
|
-
"@nocobase/utils": "2.4.0-alpha.
|
|
25
|
+
"@nocobase/utils": "2.4.0-alpha.6",
|
|
26
26
|
"ahooks": "3.7.8",
|
|
27
27
|
"@formily/reactive": "2.3.7"
|
|
28
28
|
};
|
package/dist/server/plugin.js
CHANGED
|
@@ -60,11 +60,11 @@ class PluginEnvironmentVariablesServer extends import_server.Plugin {
|
|
|
60
60
|
return this.app.aesEncryptor;
|
|
61
61
|
}
|
|
62
62
|
async handleSyncMessage(message) {
|
|
63
|
-
const { type, name, value } = message;
|
|
63
|
+
const { type, name, value, isSecret } = message;
|
|
64
64
|
if (type === "updated") {
|
|
65
65
|
this.updated = true;
|
|
66
66
|
} else if (type === "setVariable") {
|
|
67
|
-
this.app.environment.setVariable(name, value);
|
|
67
|
+
this.app.environment.setVariable(name, value, { isSecret });
|
|
68
68
|
} else if (type === "removeVariable") {
|
|
69
69
|
this.app.environment.removeVariable(name);
|
|
70
70
|
this.updated = true;
|
|
@@ -183,7 +183,8 @@ class PluginEnvironmentVariablesServer extends import_server.Plugin {
|
|
|
183
183
|
await next();
|
|
184
184
|
});
|
|
185
185
|
this.db.on("environmentVariables.afterSave", async (model, { transaction }) => {
|
|
186
|
-
|
|
186
|
+
const isSecret = model.type === "secret";
|
|
187
|
+
if (isSecret) {
|
|
187
188
|
try {
|
|
188
189
|
const decrypted = await this.aesEncryptor.decrypt(model.value);
|
|
189
190
|
model.set("value", decrypted);
|
|
@@ -191,8 +192,8 @@ class PluginEnvironmentVariablesServer extends import_server.Plugin {
|
|
|
191
192
|
this.app.log.error(error);
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
|
-
this.app.environment.setVariable(model.name, model.value);
|
|
195
|
-
this.sendSyncMessage({ type: "setVariable", name: model.name, value: model.value }, { transaction });
|
|
195
|
+
this.app.environment.setVariable(model.name, model.value, { isSecret });
|
|
196
|
+
this.sendSyncMessage({ type: "setVariable", name: model.name, value: model.value, isSecret }, { transaction });
|
|
196
197
|
});
|
|
197
198
|
this.db.on("environmentVariables.afterDestroy", async (model, { transaction }) => {
|
|
198
199
|
this.app.environment.removeVariable(model.name);
|
|
@@ -208,7 +209,8 @@ class PluginEnvironmentVariablesServer extends import_server.Plugin {
|
|
|
208
209
|
}
|
|
209
210
|
const items = await repository.find();
|
|
210
211
|
for (const model of items) {
|
|
211
|
-
|
|
212
|
+
const isSecret = model.type === "secret";
|
|
213
|
+
if (isSecret) {
|
|
212
214
|
try {
|
|
213
215
|
const decrypted = await this.aesEncryptor.decrypt(model.value);
|
|
214
216
|
model.set("value", decrypted);
|
|
@@ -216,7 +218,7 @@ class PluginEnvironmentVariablesServer extends import_server.Plugin {
|
|
|
216
218
|
this.app.log.error(error);
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
|
-
this.app.environment.setVariable(model.name, model.value);
|
|
221
|
+
this.app.environment.setVariable(model.name, model.value, { isSecret });
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-environment-variables",
|
|
3
|
-
"version": "2.4.0-alpha.
|
|
3
|
+
"version": "2.4.0-alpha.6",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@nocobase/client": "2.x",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"System management"
|
|
22
22
|
],
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "1fc4fcd17a0cd79912a642600bdc2103e2104bdb"
|
|
25
25
|
}
|