WILT: LastPass integration for shell scripts

Using Docker is great. I can keep multiple environments on hand for when I need them, like having a dedicated behave container I can keep up to date with all dependencies without worring about clashes with other tools. I can call this container whenever I want with:

docker run -i --rm \
    -v "$(pwd)":/uat \
    -t pytest behave \
    --define baseurl="https://testurl.dev" \
    --define admin_user="admin" \
    --define admin_password="password" \
    --junit --capture --capture-stderr /uat

It's great! Except that my test username and password is stored in my zsh history. Or I bake it into the Docker container. That's less than ideal. However, using the password manager LastPass I can download a command line tool. So I can use a quick sub-command in the docker call to get the credentials from LastPass. If I haven't logged in to the LastPass shell recently it prompts me - so it's not a permanent store either.

docker run -i --rm \
    -v "$(pwd)":/uat \
    -t pytest behave \
    --define baseurl="https://testurl.dev" \
    --define admin_user="$(lpass show --field username_field lastpass_secret_id)" \
    --define admin_password="$(lpass show --field password_field lastpass_secret_id)" \
    --junit --capture --capture-stderr /uat

Feels quite a bit safer this way.