When using Lando as local development tooling, you will be familiar that localhost ports get assigned randomly. This can be tricky if you need to connect to a container regurarily.
This is a short shell function which builds a MySQL/MariaDB connection URI string using the lando
and jq
binaries.
Install jq
JQ is a lightweight and flexible command-line JSON processor made by Stephen Dolan which is used to extract details form the lando info
JSON output.
macOS
brew install jq
Ubuntu
sudo apt-get install jq
Windows
Shell function
Of course, you can alter the function to output any combination of connection details.
This example always uses the database
lando service.
function db
if not test -f .lando.yml
echo "Info: No .lando.yml file found"
return
end
set LANDO_SERVICE "database"
set LANDO_INFO (lando info --filter "service=$LANDO_SERVICE" --format json)
set DB_CONNECTION "mysql"
set DB_HOST (echo $LANDO_INFO | jq '.[0].external_connection.host' | sed 's/\"//g')
set DB_DATABASE (echo $LANDO_INFO | jq '.[0].creds.database' | sed 's/\"//g')
set DB_USERNAME (echo $LANDO_INFO | jq '.[0].creds.user' | sed 's/\"//g')
set DB_PASSWORD (echo $LANDO_INFO | jq '.[0].creds.password' | sed 's/\"//g')
set DB_PORT (echo $LANDO_INFO | jq '.[0].external_connection.port' | sed 's/\"//g')
if test "$DB_PORT" = "true"
set DB_PORT (echo $LANDO_INFO | jq '.[0].internal_connection.port' | sed 's/\"//g')
end
set DB_URL "$DB_CONNECTION://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_DATABASE"
echo "Opening $DB_URL"
open $DB_URL
end
Read more...
![How to style <progress> Element with Tailwind](/cdn-cgi/image/width=600px,quality=90/https://cdn-a.romanzipp.com/blog/how-to-style-progress-element-with-tailwind/cover.jpg)
How to style <progress> Element with Tailwind
Styling the HTML progress element isn't as straight forward as you think. We'll take a look and craft pretty progresses with Tailwind CSS.
![Laravel dd() not showing Dump as HTML](/cdn-cgi/image/width=600px,quality=90/https://cdn-a.romanzipp.com/blog/laravel-dd-not-showing-dump-as-html/cover.jpg)
Laravel dd() not showing Dump as HTML
I recently ran into an issue where the Laravel dd() Helper did not show anything, what the heck?
Comments