poad 2.10.0 → 2.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poad",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "engine": "0.7.0",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
package/project/info.js CHANGED
@@ -49,7 +49,11 @@ module.exports = async () => {
49
49
  const label = chalk.bold(s.label.padEnd(width));
50
50
  if (running) {
51
51
  console.log(`${chalk.greenBright('●')} ${label} ${chalk.greenBright('running')}`);
52
- for (const [k, v] of Object.entries(s.info(config))) console.log(` ${chalk.grey(k.padEnd(16))} ${v}`);
52
+ for (const [k, v] of Object.entries(s.info(config, root))) {
53
+ // Une liste (comptes de test) : une ligne par entrée, alignées
54
+ const lines = Array.isArray(v) ? v : [v];
55
+ lines.forEach((l, i) => console.log(` ${chalk.grey((i ? '' : k).padEnd(16))} ${l}`));
56
+ }
53
57
  } else if (configured) {
54
58
  const how = s.optional ? `poad run ${s.cmd}` : 'poad stop && poad start';
55
59
  console.log(`${chalk.yellowBright('○')} ${label} ${chalk.yellowBright('stopped')} ${chalk.grey(`(${how})`)}`);
package/utils/services.js CHANGED
@@ -8,6 +8,17 @@
8
8
  const kc = require('./keycloak');
9
9
  const valkey = require('./valkey');
10
10
  const mail = require('./mail');
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ const readKeycloakUsers = (root) => {
15
+ if (!root) return null;
16
+ try {
17
+ return JSON.parse(fs.readFileSync(path.join(kc.dataDir(root), 'users.json'), 'utf-8'));
18
+ } catch {
19
+ return null;
20
+ }
21
+ };
11
22
 
12
23
  const SERVICES = [
13
24
  {
@@ -26,11 +37,20 @@ const SERVICES = [
26
37
  cmd: 'kc',
27
38
  container: (config) => kc.containerName(config),
28
39
  configured: (config) => Boolean(config.keycloak && config.keycloak.port),
29
- info: (config) => ({
30
- URL: `http://localhost:${config.keycloak.port}`,
31
- Issuer: `http://localhost:${config.keycloak.port}/realms/${kc.REALM}`,
32
- Provider: `"${kc.PROVIDER}"`,
33
- }),
40
+ info: (config, root) => {
41
+ const out = {
42
+ URL: `http://localhost:${config.keycloak.port}`,
43
+ Issuer: `http://localhost:${config.keycloak.port}/realms/${kc.REALM}`,
44
+ Provider: `"${kc.PROVIDER}"`,
45
+ };
46
+ // Comptes de test du realm (poad/data/keycloak/users.json) : locaux, faits pour être affichés
47
+ const users = readKeycloakUsers(root);
48
+ if (users) {
49
+ out['Admin console'] = `http://localhost:${config.keycloak.port}/admin (admin / ${users.admin_password})`;
50
+ out['Test users'] = users.users.map((u) => `${u.username} / ${u.password} ${u.email}${u.emailVerified ? '' : ' (email not verified)'}`);
51
+ }
52
+ return out;
53
+ },
34
54
  },
35
55
  {
36
56
  id: 'valkey',