@govuk-pay/cli 0.0.45 → 0.0.46

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/cli",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "GOV.UK Pay Command Line Interface",
5
5
  "bin": {
6
6
  "pay": "bin/cli.js",
@@ -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 access, or write-access to the database? [R/w]: ');
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 'read-only';
55
+ return 'readonly';
56
56
  }
57
57
  else if (answer === 'w') {
58
58
  printGreen('Database write access requested');
59
- return 'write';
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 === 'write') {
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 === 'write') {
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 === 'write') {
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
  }