Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit ad2e52f

Browse files
committed
Merge branch 'develop', prepare 6.2.3
2 parents 618dde8 + 6d27ef1 commit ad2e52f

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "exoframe-server",
3-
"version": "6.2.2",
3+
"version": "6.2.3-dev.2",
44
"description": "Exoframe is a self-hosted tool that allows simple one-command deployments using Docker",
55
"main": "bin/server-core.js",
66
"bin": "bin/exoframe-server.js",

src/docker/templates/compose.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ const {getHost, getEnv} = require('../../util');
1111
const generateBaseName = ({username, config}) =>
1212
`exo-${_.kebabCase(username)}-${_.kebabCase(config.name.split(':').shift())}`;
1313

14+
// maps array labels to objects, if necessary
15+
const asObjectLabels = labels =>
16+
!Array.isArray(labels)
17+
? labels
18+
: labels.reduce((acc, label) => {
19+
// Split at =, but only retain first value
20+
const [name, ...values] = label.split('=');
21+
const value = values.join('=');
22+
23+
return {...acc, [name]: value};
24+
}, {});
25+
1426
// function to update compose file with required vars
1527
const updateCompose = ({username, baseName, serverConfig, composePath}) => {
1628
const uid = uuidv1();
@@ -51,7 +63,7 @@ const updateCompose = ({username, baseName, serverConfig, composePath}) => {
5163
'traefik.enable': 'true',
5264
};
5365

54-
compose.services[svcKey].labels = Object.assign({}, extLabels, compose.services[svcKey].labels);
66+
compose.services[svcKey].labels = Object.assign({}, extLabels, asObjectLabels(compose.services[svcKey].labels));
5567
});
5668

5769
// write new compose back to file

test/deploy.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ test('Should deploy simple compose project', async done => {
440440
expect(containerOne.Labels[`traefik.http.routers.web.rule`]).toEqual('Host(`test.dev`)');
441441
expect(containerOne.Labels['custom.envvar']).toEqual('custom-value');
442442
expect(containerOne.Labels['custom.secret']).toEqual('custom-secret-value');
443+
expect(containerTwo.Labels.username).toEqual('user1234');
444+
expect(containerTwo.Labels.password).toEqual('abcde=cddfd=gdfg');
443445
expect(containerOne.NetworkSettings.Networks.exoframe).toBeDefined();
444446
expect(containerTwo.NetworkSettings.Networks.exoframe).toBeDefined();
445447

@@ -496,6 +498,8 @@ test('Should update simple compose project', async done => {
496498
expect(containerOne.Labels[`traefik.http.routers.web.rule`]).toEqual('Host(`test.dev`)');
497499
expect(containerOne.Labels['custom.envvar']).toEqual('custom-value');
498500
expect(containerOne.Labels['custom.secret']).toEqual('custom-secret-value');
501+
expect(containerTwo.Labels.username).toEqual('user1234');
502+
expect(containerTwo.Labels.password).toEqual('abcde=cddfd=gdfg');
499503
expect(containerOne.NetworkSettings.Networks.exoframe).toBeDefined();
500504
expect(containerTwo.NetworkSettings.Networks.exoframe).toBeDefined();
501505

test/fixtures/compose-project/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ services:
88
custom.secret: '${CUSTOM_SECRET}'
99
redis:
1010
image: 'redis:alpine'
11+
labels:
12+
- username=user1234
13+
- "password=abcde=cddfd=gdfg"

0 commit comments

Comments
 (0)