Skip to content

Commit

Permalink
lando/lamp#51: Make database healthcheck not rely on pwd/user/db values.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Mar 8, 2024
1 parent 6318abf commit c878bbd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.1.0 - [March 8, 2024](https://github.com/lando/mysql/releases/tag/v1.1.0)

### Fixes
* Allow empty password and other creds fields to pass healthcheck [lando/lamp#51](https://github.com/lando/lamp/issues/51)

## v1.0.0 - [December 7, 2023](https://github.com/lando/mysql/releases/tag/v1.0.0)

* Dialed fully for `lando update`
Expand Down
6 changes: 6 additions & 0 deletions examples/custom/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ services:
custom_auth:
type: mysql:8.0
authentication: mysql_native_password
custom_no_password:
type: mysql:8.0
creds:
user: pirog
database: stuff
password:
tooling:
mysql:
cmd: mysql
Expand Down
17 changes: 12 additions & 5 deletions utils/get-default-healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

// checks to see if a setting is disabled
module.exports = options => {
return [
let healthcheck = [
'mysql',
`--host=${options.name}`,
`--user=${options.creds.user}`,
`--database=${options.creds.database}`,
`--password=${options.creds.password}`,
];

// Only include whatever creds are available.
options.creds.user ? healthcheck.push(`--user=${options.creds.user}`) : false;
options.creds.database ? healthcheck.push(`--database=${options.creds.database}`) : false;
options.creds.password ? healthcheck.push(`--password=${options.creds.password}`) : false;

healthcheck = healthcheck.concat([
'--silent',
'--execute',
'"SHOW TABLES;"',
].join(' ');
]);

return healthcheck.join(' ');
};

0 comments on commit c878bbd

Please sign in to comment.