Lando will inject an environment variable called
$LANDO_INFO into each service. This is a
JSON string representation of the
lando info command and you can use it to see valuable information about other services such as service hostnames and database connection information and credentials.
This is helpful if you want to set applicaiton configuration in a way that portable and dynamic between many lando apps.
Use internal_connection information
For services with both
internal_connection information. ALWAYS use the
internal_connection information inside of your application.
Here are some examples of code on how to parse
$info = json_decode(getenv('LANDO_INFO'), TRUE); print_r($info);
var info = JSON.parse(process.env.LANDO_INFO); console.log(info);;
More examples coming soon but in the meantime consult the documentation for your language on how to:
- Grab an environment variable
- Decode a JSON string to an object