Skip to content

Commit fb0b961

Browse files
committed
lando/lamp#51: Make database healthcheck not rely on pwd/user/db values.
1 parent ae28c19 commit fb0b961

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

examples/custom/.lando.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ services:
99
database: stuff
1010
config:
1111
database: config/my.cnf
12+
customnopwd:
13+
type: mariadb:10.3
14+
portforward: true
15+
creds:
16+
user: pirog
17+
password:
18+
database: stuff
1219
customimage:
1320
type: mariadb:custom
1421
portforward: true

utils/get-default-healthcheck.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22

33
// checks to see if a setting is disabled
44
module.exports = options => {
5-
return [
5+
let healthcheck = [
66
'mysql',
77
`--host=${options.name}`,
8-
`--user=${options.creds.user}`,
9-
`--database=${options.creds.database}`,
10-
`--password=${options.creds.password}`,
8+
];
9+
10+
// Only include whatever creds are available.
11+
options.creds.user ? healthcheck.push(`--user=${options.creds.user}`) : false;
12+
options.creds.database ? healthcheck.push(`--database=${options.creds.database}`) : false;
13+
options.creds.password ? healthcheck.push(`--password=${options.creds.password}`) : false;
14+
15+
healthcheck = healthcheck.concat([
1116
'--silent',
1217
'--execute',
1318
'"SHOW TABLES;"',
14-
].join(' ');
19+
]);
20+
21+
return healthcheck.join(' ');
1522
};

0 commit comments

Comments
 (0)