@govuk-pay/cli 0.0.45 → 0.0.47
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
|
@@ -19,6 +19,9 @@ const dockerComposeController = {
|
|
|
19
19
|
},
|
|
20
20
|
build(composeFilePath) {
|
|
21
21
|
(0, node_child_process_1.spawnSync)('docker', ['compose', '--file', composeFilePath, 'build'], { shell: true, stdio: 'inherit' });
|
|
22
|
+
},
|
|
23
|
+
recreate(composeFilePath, service) {
|
|
24
|
+
(0, node_child_process_1.spawnSync)('docker', ['compose', '--file', composeFilePath, 'up', '-d', service], { shell: true, stdio: 'inherit' });
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
27
|
exports.default = dockerComposeController;
|
|
@@ -18,6 +18,11 @@ const builder = (yargs) => {
|
|
|
18
18
|
.positional('app', {
|
|
19
19
|
type: 'string',
|
|
20
20
|
description: 'Container to restart'
|
|
21
|
+
})
|
|
22
|
+
.option('force', {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
default: false,
|
|
25
|
+
description: 'Force recreate (not just restart) the container, this will bring in changes to the .env files.'
|
|
21
26
|
});
|
|
22
27
|
};
|
|
23
28
|
exports.builder = builder;
|
|
@@ -25,6 +30,7 @@ exports.handler = restartHandler;
|
|
|
25
30
|
async function restartHandler(argv) {
|
|
26
31
|
await (0, standardContent_1.showHeader)();
|
|
27
32
|
const service = argv.app;
|
|
33
|
+
const force = argv.force;
|
|
28
34
|
const renderedTempaltesPath = (0, configs_js_1.ensureConfigDirectory)(exports.DOCKER_COMPOSE_RENDERED_TEMPLATES_PATH);
|
|
29
35
|
const composeFilePath = (0, last_up_record_js_1.getLastUp)(renderedTempaltesPath);
|
|
30
36
|
if (composeFilePath === undefined) {
|
|
@@ -32,7 +38,13 @@ async function restartHandler(argv) {
|
|
|
32
38
|
}
|
|
33
39
|
const composeFileName = node_path_1.default.basename(composeFilePath);
|
|
34
40
|
const clusterName = composeFileName.substring(0, composeFileName.lastIndexOf('.yaml'));
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
if (force) {
|
|
42
|
+
console.log(`\nForce recreating '${service} in cluster ${clusterName}`);
|
|
43
|
+
docker_compose_controller_js_1.default.recreate(composeFilePath, service);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log(`\nRestarting '${service}' in cluster ${clusterName}`);
|
|
47
|
+
docker_compose_controller_js_1.default.restart(composeFilePath, service);
|
|
48
|
+
}
|
|
37
49
|
}
|
|
38
50
|
exports.default = restartHandler;
|
package/src/commands/tunnel.js
CHANGED
|
@@ -44,7 +44,7 @@ async function readInputForReadOrWriteDBAccess() {
|
|
|
44
44
|
input: process.stdin,
|
|
45
45
|
output: process.stdout
|
|
46
46
|
});
|
|
47
|
-
let answer = await rl.question('Do you require read-only
|
|
47
|
+
let answer = await rl.question('Do you require read-only, read-write, or admin access to the database? [R/w/a]: ');
|
|
48
48
|
rl.close();
|
|
49
49
|
if (answer === undefined || answer === '') {
|
|
50
50
|
answer = 'R';
|
|
@@ -52,11 +52,15 @@ async function readInputForReadOrWriteDBAccess() {
|
|
|
52
52
|
}
|
|
53
53
|
if (answer === 'R' || answer === 'r') {
|
|
54
54
|
printGreen('Database read-only access requested');
|
|
55
|
-
return '
|
|
55
|
+
return 'readonly';
|
|
56
56
|
}
|
|
57
57
|
else if (answer === 'w') {
|
|
58
58
|
printGreen('Database write access requested');
|
|
59
|
-
return '
|
|
59
|
+
return 'readwrite';
|
|
60
|
+
}
|
|
61
|
+
else if (answer === 'a') {
|
|
62
|
+
printGreen('Admin access requested');
|
|
63
|
+
return 'admin';
|
|
60
64
|
}
|
|
61
65
|
else {
|
|
62
66
|
printError('Invalid option entered. Exiting..');
|
|
@@ -415,9 +419,12 @@ async function printHowToTunnelText(application, environment, dbEngineVersion, d
|
|
|
415
419
|
}
|
|
416
420
|
async function getDbUser(environment, application, dbAccessType) {
|
|
417
421
|
let paramName;
|
|
418
|
-
if (dbAccessType === '
|
|
422
|
+
if (dbAccessType === 'admin') {
|
|
419
423
|
paramName = `${environment}_${application}.db_user`;
|
|
420
424
|
}
|
|
425
|
+
else if (dbAccessType === 'readwrite') {
|
|
426
|
+
paramName = `${environment}_${application}.db_support_user_readwrite`;
|
|
427
|
+
}
|
|
421
428
|
else {
|
|
422
429
|
paramName = `${environment}_${application}.db_support_user_readonly`;
|
|
423
430
|
}
|
|
@@ -434,17 +441,23 @@ async function getDbUser(environment, application, dbAccessType) {
|
|
|
434
441
|
}
|
|
435
442
|
}
|
|
436
443
|
function getPayLowPassDbSecretName(environment, user, dbAccessType) {
|
|
437
|
-
if (dbAccessType === '
|
|
444
|
+
if (dbAccessType === 'admin') {
|
|
438
445
|
return `aws/rds/application_users/${environment.split('-')[0]}/${user}`;
|
|
439
446
|
}
|
|
447
|
+
else if (dbAccessType === 'readwrite') {
|
|
448
|
+
return `aws/rds/support_readwrite_users/${environment.split('-')[0]}/${user}`;
|
|
449
|
+
}
|
|
440
450
|
else {
|
|
441
451
|
return `aws/rds/support_readonly_users/${environment.split('-')[0]}/${user}`;
|
|
442
452
|
}
|
|
443
453
|
}
|
|
444
454
|
function getPaySecretsPasswordName(dbAccessType) {
|
|
445
|
-
if (dbAccessType === '
|
|
455
|
+
if (dbAccessType === 'admin') {
|
|
446
456
|
return 'DB_PASSWORD';
|
|
447
457
|
}
|
|
458
|
+
if (dbAccessType === 'readwrite') {
|
|
459
|
+
return 'DB_SUPPORT_PASSWORD_READWRITE';
|
|
460
|
+
}
|
|
448
461
|
else {
|
|
449
462
|
return 'DB_SUPPORT_PASSWORD_READONLY';
|
|
450
463
|
}
|