@automattic/vip 3.23.0 → 3.23.2
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/bin/vip-config-envvar-delete.js +7 -3
- package/dist/bin/vip-config-envvar-set.js +9 -3
- package/dist/bin/vip-dev-env-sync-sql.js +0 -8
- package/dist/commands/dev-env-sync-sql.js +3 -3
- package/dist/lib/constants/dev-environment.js +0 -4
- package/dist/lib/envvar/api-delete.js +16 -4
- package/dist/lib/envvar/api-set.js +17 -4
- package/dist/lib/envvar/api.js +1 -0
- package/dist/lib/envvar/input.js +23 -0
- package/npm-shrinkwrap.json +6 -23
- package/package.json +1 -1
|
@@ -63,7 +63,11 @@ async function deleteEnvVarCommand(arg, opt) {
|
|
|
63
63
|
(0, _input.cancel)();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
let reloadManifest = false;
|
|
67
|
+
if (!opt.skipConfirmation) {
|
|
68
|
+
reloadManifest = await (0, _input.promptForReloadManifest)(opt.app.typeId);
|
|
69
|
+
}
|
|
70
|
+
await (0, _api.deleteEnvVar)(opt.app.id, opt.env.id, name, reloadManifest).catch(async err => {
|
|
67
71
|
await (0, _tracker.trackEvent)('envvar_delete_mutation_error', {
|
|
68
72
|
...trackingParams,
|
|
69
73
|
error: err.message
|
|
@@ -72,8 +76,8 @@ async function deleteEnvVarCommand(arg, opt) {
|
|
|
72
76
|
});
|
|
73
77
|
await (0, _tracker.trackEvent)('envvar_delete_command_success', trackingParams);
|
|
74
78
|
console.log(_chalk.default.green(`Successfully deleted environment variable ${JSON.stringify(name)}`));
|
|
75
|
-
if (!opt.skipConfirmation) {
|
|
76
|
-
|
|
79
|
+
if (!opt.skipConfirmation && !reloadManifest) {
|
|
80
|
+
(0, _input.showDeployWarning)();
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
(0, _command.default)({
|
|
@@ -82,7 +82,11 @@ async function setEnvVarCommand(arg, opt) {
|
|
|
82
82
|
(0, _input.cancel)();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
let reloadManifest = false;
|
|
86
|
+
if (!opt.skipConfirmation) {
|
|
87
|
+
reloadManifest = await (0, _input.promptForReloadManifest)(opt.app.typeId);
|
|
88
|
+
}
|
|
89
|
+
await (0, _api.setEnvVar)(opt.app.id, opt.env.id, name, value, reloadManifest).catch(async err => {
|
|
86
90
|
await (0, _tracker.trackEvent)('envvar_set_mutation_error', {
|
|
87
91
|
...trackingParams,
|
|
88
92
|
error: err.message
|
|
@@ -91,8 +95,10 @@ async function setEnvVarCommand(arg, opt) {
|
|
|
91
95
|
});
|
|
92
96
|
await (0, _tracker.trackEvent)('envvar_set_command_success', trackingParams);
|
|
93
97
|
console.log(_chalk.default.green(`Successfully set environment variable ${JSON.stringify(name)}`));
|
|
94
|
-
if (
|
|
95
|
-
console.log(_chalk.default.
|
|
98
|
+
if (reloadManifest) {
|
|
99
|
+
console.log(_chalk.default.yellow('Environment variable is active and available.'));
|
|
100
|
+
} else if (!opt.skipConfirmation) {
|
|
101
|
+
(0, _input.showDeployWarning)();
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
(0, _command.default)({
|
|
@@ -188,11 +188,11 @@ class DevEnvSyncSQLCommand {
|
|
|
188
188
|
await (0, _promises.pipeline)(streams);
|
|
189
189
|
_fs.default.renameSync(outputFile, this.sqlFile);
|
|
190
190
|
}
|
|
191
|
-
|
|
192
|
-
if (this.env.isMultisite
|
|
191
|
+
getSiteUrlsFromSDS() {
|
|
192
|
+
if (this.env.isMultisite) {
|
|
193
193
|
return this.fetchAllSites(Number(this.app.id), Number(this.env.id));
|
|
194
194
|
}
|
|
195
|
-
return
|
|
195
|
+
return Promise.resolve([]);
|
|
196
196
|
}
|
|
197
197
|
fetchSitesPage(api, appId, environmentId, after) {
|
|
198
198
|
return api.query({
|
|
@@ -18,10 +18,6 @@ const DEV_ENVIRONMENT_PHP_VERSIONS = exports.DEV_ENVIRONMENT_PHP_VERSIONS = {
|
|
|
18
18
|
image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.2',
|
|
19
19
|
label: '8.2 (recommended)'
|
|
20
20
|
},
|
|
21
|
-
8.1: {
|
|
22
|
-
image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.1',
|
|
23
|
-
label: '8.1'
|
|
24
|
-
},
|
|
25
21
|
8.3: {
|
|
26
22
|
image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3',
|
|
27
23
|
label: '8.3'
|
|
@@ -6,9 +6,20 @@ var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
|
6
6
|
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
const mutation = (0, _graphqlTag.default)`
|
|
9
|
-
mutation DeleteEnvironmentVariable(
|
|
9
|
+
mutation DeleteEnvironmentVariable(
|
|
10
|
+
$appId: Int!
|
|
11
|
+
$envId: Int!
|
|
12
|
+
$name: String!
|
|
13
|
+
$reloadManifest: Boolean!
|
|
14
|
+
) {
|
|
10
15
|
deleteEnvironmentVariable(
|
|
11
|
-
input: {
|
|
16
|
+
input: {
|
|
17
|
+
applicationId: $appId
|
|
18
|
+
environmentId: $envId
|
|
19
|
+
name: $name
|
|
20
|
+
value: ""
|
|
21
|
+
reloadManifest: $reloadManifest
|
|
22
|
+
}
|
|
12
23
|
) {
|
|
13
24
|
environmentVariables {
|
|
14
25
|
total
|
|
@@ -19,12 +30,13 @@ const mutation = (0, _graphqlTag.default)`
|
|
|
19
30
|
}
|
|
20
31
|
}
|
|
21
32
|
`;
|
|
22
|
-
async function deleteEnvVar(appId, envId, name) {
|
|
33
|
+
async function deleteEnvVar(appId, envId, name, reloadManifest = false) {
|
|
23
34
|
const api = (0, _api.default)();
|
|
24
35
|
const variables = {
|
|
25
36
|
appId,
|
|
26
37
|
envId,
|
|
27
|
-
name
|
|
38
|
+
name,
|
|
39
|
+
reloadManifest
|
|
28
40
|
};
|
|
29
41
|
return api.mutate({
|
|
30
42
|
mutation,
|
|
@@ -6,9 +6,21 @@ var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
|
6
6
|
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
const mutation = (0, _graphqlTag.default)`
|
|
9
|
-
mutation AddEnvironmentVariable(
|
|
9
|
+
mutation AddEnvironmentVariable(
|
|
10
|
+
$appId: Int!
|
|
11
|
+
$envId: Int!
|
|
12
|
+
$name: String!
|
|
13
|
+
$value: String!
|
|
14
|
+
$reloadManifest: Boolean!
|
|
15
|
+
) {
|
|
10
16
|
addEnvironmentVariable(
|
|
11
|
-
input: {
|
|
17
|
+
input: {
|
|
18
|
+
applicationId: $appId
|
|
19
|
+
environmentId: $envId
|
|
20
|
+
name: $name
|
|
21
|
+
value: $value
|
|
22
|
+
reloadManifest: $reloadManifest
|
|
23
|
+
}
|
|
12
24
|
) {
|
|
13
25
|
environmentVariables {
|
|
14
26
|
total
|
|
@@ -19,13 +31,14 @@ const mutation = (0, _graphqlTag.default)`
|
|
|
19
31
|
}
|
|
20
32
|
}
|
|
21
33
|
`;
|
|
22
|
-
async function setEnvVar(appId, envId, name, value) {
|
|
34
|
+
async function setEnvVar(appId, envId, name, value, reloadManifest = false) {
|
|
23
35
|
const api = (0, _api.default)();
|
|
24
36
|
const variables = {
|
|
25
37
|
appId,
|
|
26
38
|
envId,
|
|
27
39
|
name,
|
|
28
|
-
value
|
|
40
|
+
value,
|
|
41
|
+
reloadManifest
|
|
29
42
|
};
|
|
30
43
|
return api.mutate({
|
|
31
44
|
mutation,
|
package/dist/lib/envvar/api.js
CHANGED
package/dist/lib/envvar/input.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.cancel = cancel;
|
|
5
5
|
exports.confirm = confirm;
|
|
6
|
+
exports.promptForReloadManifest = promptForReloadManifest;
|
|
6
7
|
exports.promptForValue = promptForValue;
|
|
8
|
+
exports.showDeployWarning = showDeployWarning;
|
|
7
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
10
|
var _enquirer = require("enquirer");
|
|
11
|
+
var _app = require("../app");
|
|
9
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
13
|
function cancel() {
|
|
11
14
|
console.log(_chalk.default.yellow('Command cancelled by user.'));
|
|
@@ -31,4 +34,24 @@ async function promptForValue(message, mustMatch) {
|
|
|
31
34
|
}
|
|
32
35
|
});
|
|
33
36
|
return str?.trim() ?? '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Prompts the user to confirm whether to apply the environment variable update now.
|
|
41
|
+
*
|
|
42
|
+
* @param {number} appTypeId - The application type ID
|
|
43
|
+
* @return {Promise<boolean>} Whether to reload the manifest
|
|
44
|
+
*/
|
|
45
|
+
async function promptForReloadManifest(appTypeId) {
|
|
46
|
+
if ((0, _app.isAppNodejs)(appTypeId)) {
|
|
47
|
+
console.log(_chalk.default.yellow(`⚠️ Note: ${_chalk.default.bold('Only applies to runtime variable changes.')} Build-time environment variable changes won't take effect until your next deploy.`));
|
|
48
|
+
}
|
|
49
|
+
return await confirm('Apply this environment variable update now?');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Shows a warning message that the environment variable update won't be available until the next deploy.
|
|
54
|
+
*/
|
|
55
|
+
function showDeployWarning() {
|
|
56
|
+
console.log(_chalk.default.bgYellow(_chalk.default.bold('Important:')), 'This environment variable update will not be available until the next code deploy is made to this environment.');
|
|
34
57
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "3.23.
|
|
3
|
+
"version": "3.23.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@automattic/vip",
|
|
9
|
-
"version": "3.23.
|
|
9
|
+
"version": "3.23.2",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -13386,13 +13386,13 @@
|
|
|
13386
13386
|
}
|
|
13387
13387
|
},
|
|
13388
13388
|
"node_modules/socket.io-client": {
|
|
13389
|
-
"version": "4.8.
|
|
13390
|
-
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.
|
|
13391
|
-
"integrity": "sha512-
|
|
13389
|
+
"version": "4.8.3",
|
|
13390
|
+
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz",
|
|
13391
|
+
"integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==",
|
|
13392
13392
|
"license": "MIT",
|
|
13393
13393
|
"dependencies": {
|
|
13394
13394
|
"@socket.io/component-emitter": "~3.1.0",
|
|
13395
|
-
"debug": "~4.
|
|
13395
|
+
"debug": "~4.4.1",
|
|
13396
13396
|
"engine.io-client": "~6.6.1",
|
|
13397
13397
|
"socket.io-parser": "~4.2.4"
|
|
13398
13398
|
},
|
|
@@ -13400,23 +13400,6 @@
|
|
|
13400
13400
|
"node": ">=10.0.0"
|
|
13401
13401
|
}
|
|
13402
13402
|
},
|
|
13403
|
-
"node_modules/socket.io-client/node_modules/debug": {
|
|
13404
|
-
"version": "4.3.7",
|
|
13405
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
|
13406
|
-
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
|
13407
|
-
"license": "MIT",
|
|
13408
|
-
"dependencies": {
|
|
13409
|
-
"ms": "^2.1.3"
|
|
13410
|
-
},
|
|
13411
|
-
"engines": {
|
|
13412
|
-
"node": ">=6.0"
|
|
13413
|
-
},
|
|
13414
|
-
"peerDependenciesMeta": {
|
|
13415
|
-
"supports-color": {
|
|
13416
|
-
"optional": true
|
|
13417
|
-
}
|
|
13418
|
-
}
|
|
13419
|
-
},
|
|
13420
13403
|
"node_modules/socket.io-parser": {
|
|
13421
13404
|
"version": "4.2.4",
|
|
13422
13405
|
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|