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 +1 -1
- package/project/info.js +5 -1
- package/utils/services.js +25 -5
package/package.json
CHANGED
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)))
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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',
|