poad 2.18.1 → 2.18.2

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/global/run.js CHANGED
@@ -144,7 +144,7 @@ module.exports = async (args = {}) => {
144
144
  ExposedPorts: { '8080/tcp': {} },
145
145
  HostConfig: {
146
146
  NetworkMode: net.NetworkMode,
147
- PortBindings: { '8080/tcp': [{ HostPort: String(port) }] },
147
+ PortBindings: { '8080/tcp': [{ HostIp: require('../utils/ports').hostIp(config), HostPort: String(port) }] },
148
148
  Binds: [`${importDir}:/opt/keycloak/data/import:ro`],
149
149
  AutoRemove: true,
150
150
  ...require('../utils/logs').containerLogConfig(config),
package/global/start.js CHANGED
@@ -93,8 +93,8 @@ module.exports = async (args = {}) => {
93
93
  HostConfig: {
94
94
  NetworkMode: net.NetworkMode,
95
95
  PortBindings: {
96
- '5432/tcp': [{ HostPort: config.db.port.toString() }],
97
- '8000/tcp': [{ HostPort: config.web.port.toString() }],
96
+ '5432/tcp': [{ HostIp: require('../utils/ports').hostIp(config), HostPort: config.db.port.toString() }],
97
+ '8000/tcp': [{ HostIp: require('../utils/ports').hostIp(config), HostPort: config.web.port.toString() }],
98
98
  ...gelf.bindings,
99
99
  },
100
100
  Binds: [path.dirname(root) + '/data:/data'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poad",
3
- "version": "2.18.1",
3
+ "version": "2.18.2",
4
4
  "engine": "0.10.1",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -76,7 +76,8 @@ async function ensureRunning(docker, image) {
76
76
  ExposedPorts: { '8080/tcp': {} },
77
77
  Labels: { 'io.poad.service': 'keycloak-shared' },
78
78
  HostConfig: {
79
- PortBindings: { '8080/tcp': [{ HostPort: String(state.port) }] },
79
+ // Commun à plusieurs projets : toujours limité à cette machine
80
+ PortBindings: { '8080/tcp': [{ HostIp: '127.0.0.1', HostPort: String(state.port) }] },
80
81
  AutoRemove: true,
81
82
  },
82
83
  });
package/utils/mail.js CHANGED
@@ -71,7 +71,7 @@ const startMailpit = async (docker, config) => {
71
71
  ExposedPorts: { '8025/tcp': {} },
72
72
  HostConfig: {
73
73
  NetworkMode: net.NetworkMode,
74
- PortBindings: { '8025/tcp': [{ HostPort: String(mailPort(config)) }] },
74
+ PortBindings: { '8025/tcp': [{ HostIp: require('./ports').hostIp(config), HostPort: String(mailPort(config)) }] },
75
75
  AutoRemove: true,
76
76
  ...require('./logs').containerLogConfig(config),
77
77
  },
package/utils/ports.js CHANGED
@@ -56,4 +56,14 @@ const findFreePorts = async (count, minPort = 1024, maxPort = 65535) => {
56
56
  return Array.from(freePorts);
57
57
  };
58
58
 
59
- module.exports = { findFreePorts };
59
+ /**
60
+ * Interface d'écoute des ports publiés sur la machine. Par défaut 127.0.0.1 :
61
+ * l'API, la base (postgres/postgres), Mailpit et Keycloak ne sont joignables
62
+ * que depuis cette machine. [web] expose = true dans poad/config.toml les
63
+ * ouvre au réseau (téléphone, autre poste) ; la console sans mot de passe est
64
+ * alors coupée.
65
+ */
66
+ const exposed = (config) => Boolean(config && config.web && config.web.expose === true);
67
+ const hostIp = (config) => (exposed(config) ? '0.0.0.0' : '127.0.0.1');
68
+
69
+ module.exports = { findFreePorts, exposed, hostIp };
package/utils/report.js CHANGED
@@ -29,6 +29,9 @@ async function printProject(root, config) {
29
29
  console.log(' ');
30
30
  const info = {
31
31
  Engine: config.engine,
32
+ Network: require('./ports').exposed(config)
33
+ ? chalk.yellowBright('exposed: API, database (postgres/postgres) and Mailpit reachable from the network ([web] expose = true)')
34
+ : 'this machine only (127.0.0.1)',
32
35
  'API URL': `http://localhost:${config.web.port}`,
33
36
  'DB URL': `postgres://postgres:postgres@localhost:${config.db.port}/postgres`,
34
37
  ...storageInfo(config),