diff --git a/examples/custom/.lando.yml b/examples/custom/.lando.yml index 7cbeb61..3fa2633 100644 --- a/examples/custom/.lando.yml +++ b/examples/custom/.lando.yml @@ -9,6 +9,13 @@ services: database: stuff config: database: config/my.cnf + customnopwd: + type: mariadb:10.3 + portforward: true + creds: + user: pirog + password: + database: stuff customimage: type: mariadb:custom portforward: true diff --git a/utils/get-default-healthcheck.js b/utils/get-default-healthcheck.js index cf67b74..101bd0c 100644 --- a/utils/get-default-healthcheck.js +++ b/utils/get-default-healthcheck.js @@ -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(' '); };