Skip to content

Commit

Permalink
lando/lamp#51: Make database healthcheck not rely on user/db values.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Mar 8, 2024
1 parent 465c34b commit 67b4b68
Show file tree
Hide file tree
Showing 3 changed files with 19 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/postgres/releases/tag/v1.1.0)

### Fixes
* Allow empty user/dbname fields to pass healthcheck [lando/lamp#51](https://github.com/lando/lamp/issues/51)

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

* Dialed fully for `lando update`.
Expand Down
6 changes: 5 additions & 1 deletion examples/custom/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ services:
cross:
type: postgres:14
portforward: true
blank_user:
type: postgres
creds:
user:
tooling:
verifycustom:
service: custom
Expand All @@ -29,4 +33,4 @@ tooling:
# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/postgres": ./../../
"@lando/postgres": ./../../
13 changes: 9 additions & 4 deletions utils/get-default-healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

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

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

return healthcheck.concat([
'-c "\\\l"',
].join(' ');
]).join(' ');
};

0 comments on commit 67b4b68

Please sign in to comment.