diff --git a/CHANGELOG.md b/CHANGELOG.md index c18a54a..65addf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/examples/custom/.lando.yml b/examples/custom/.lando.yml index c2b5abd..7aab95f 100644 --- a/examples/custom/.lando.yml +++ b/examples/custom/.lando.yml @@ -14,6 +14,10 @@ services: cross: type: postgres:14 portforward: true + blank_user: + type: postgres + creds: + user: tooling: verifycustom: service: custom @@ -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": ./../../ \ No newline at end of file + "@lando/postgres": ./../../ diff --git a/utils/get-default-healthcheck.js b/utils/get-default-healthcheck.js index aa5b7af..bd0e484 100644 --- a/utils/get-default-healthcheck.js +++ b/utils/get-default-healthcheck.js @@ -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(' '); };