@govuk-pay/cli 0.0.46 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/cli",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "GOV.UK Pay Command Line Interface",
5
5
  "bin": {
6
6
  "pay": "bin/cli.js",
@@ -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
- console.log(`\nRestarting '${service} in cluster ${clusterName}`);
36
- docker_compose_controller_js_1.default.restart(composeFilePath, service);
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;