Skip to content

Commit

Permalink
lando/lamp#51: Make database healthcheck not rely on pwd/user/db valu…
Browse files Browse the repository at this point in the history
…es. (#43)
  • Loading branch information
reynoldsalec authored Mar 8, 2024
1 parent 5b83a2a commit b78401f
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 b78401f

Please sign in to comment.