@cloud-cli/dx 2.1.0 → 2.1.1
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/README.md +1 -1
- package/dist/containers.js +5 -5
- package/dist/store.d.ts +1 -1
- package/dist/store.js +6 -6
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm i @cloud-cli/dx
|
|
|
14
14
|
cy dx.list
|
|
15
15
|
cy dx.prune
|
|
16
16
|
cy dx.pull --image node:latest
|
|
17
|
-
cy dx.add --name node-app --image node:latest --volumes 'volume:/container/path' --port '8080' --
|
|
17
|
+
cy dx.add --name node-app --image node:latest --volumes 'volume:/container/path' --port '8080' --domain 'foo.example.com'
|
|
18
18
|
cy dx.start --name node-app --env 'FOO=bar'
|
|
19
19
|
cy dx.logs --name node-app
|
|
20
20
|
cy dx.stop --name node-app
|
package/dist/containers.js
CHANGED
|
@@ -69,11 +69,11 @@ export async function startContainer(options, { run }) {
|
|
|
69
69
|
}
|
|
70
70
|
const vars = (await run('env.show', { name }));
|
|
71
71
|
const { env, envKeys } = await getEnvVars(vars);
|
|
72
|
-
const container =
|
|
72
|
+
const container = findContainer(name);
|
|
73
73
|
const volumes = addExecFlag(container.volumes, 'v');
|
|
74
74
|
const ports = ['-p' + env.PORT + ':' + (container.port || env.PORT)];
|
|
75
|
-
if (container.
|
|
76
|
-
const domain = container.
|
|
75
|
+
if (container.domain) {
|
|
76
|
+
const [domain] = container.domain.split('/');
|
|
77
77
|
await run('px.update', { domain, target: 'http://localhost:' + env.PORT });
|
|
78
78
|
await run('dns.add', { domain });
|
|
79
79
|
}
|
|
@@ -113,9 +113,9 @@ export async function stopContainer(options, { run }) {
|
|
|
113
113
|
}
|
|
114
114
|
await exec('docker', ['stop', '-t', '5', name]);
|
|
115
115
|
await exec('docker', ['rm', name]);
|
|
116
|
-
const containers = [
|
|
116
|
+
const containers = [findContainer(name)].filter(Boolean);
|
|
117
117
|
for (const container of containers) {
|
|
118
|
-
await run('dns.remove', { domain: container.
|
|
118
|
+
await run('dns.remove', { domain: container.domain });
|
|
119
119
|
}
|
|
120
120
|
return true;
|
|
121
121
|
}
|
package/dist/store.d.ts
CHANGED
package/dist/store.js
CHANGED
|
@@ -11,8 +11,8 @@ export function addContainer(options) {
|
|
|
11
11
|
throw new Error('Image required');
|
|
12
12
|
const volumes = options.volumes ? sanitiseVolumes(options.volumes) : '';
|
|
13
13
|
const port = options.port || '';
|
|
14
|
-
const
|
|
15
|
-
const container = { name, image, volumes, port,
|
|
14
|
+
const domain = options.domain || '';
|
|
15
|
+
const container = { name, image, volumes, port, domain };
|
|
16
16
|
set(name, container);
|
|
17
17
|
return container;
|
|
18
18
|
}
|
|
@@ -31,7 +31,7 @@ export function getContainer(options) {
|
|
|
31
31
|
const optionSplitter = /,\s*/;
|
|
32
32
|
export function updateContainer(options) {
|
|
33
33
|
readTargetName(options);
|
|
34
|
-
let { port, volumes, name, image,
|
|
34
|
+
let { port, volumes, name, image, domain } = options;
|
|
35
35
|
const container = get(name);
|
|
36
36
|
if (!container) {
|
|
37
37
|
throw new Error('Container not found');
|
|
@@ -45,14 +45,14 @@ export function updateContainer(options) {
|
|
|
45
45
|
if (image) {
|
|
46
46
|
container.image = image;
|
|
47
47
|
}
|
|
48
|
-
if (
|
|
49
|
-
container.
|
|
48
|
+
if (domain) {
|
|
49
|
+
container.domain = domain;
|
|
50
50
|
}
|
|
51
51
|
set(container.name, container);
|
|
52
52
|
return container;
|
|
53
53
|
}
|
|
54
54
|
export function listContainers(options = {}) {
|
|
55
|
-
const keys = ['name', 'image', '
|
|
55
|
+
const keys = ['name', 'image', 'domain', 'port', 'volumes'];
|
|
56
56
|
const list = getAll();
|
|
57
57
|
const filtered = keys.reduce((list, key) => {
|
|
58
58
|
if (options[key]) {
|
package/dist/types.d.ts
CHANGED