Script loads Rancher's secrets to env variables
Let's assume you want to load value of a secret named db_password to env $PG_PASS
- Make sure your Rancher environment has Secrets stack running
- Set variable value in Rancher → Infrastructure → Secrets
- Set special env variable of your container/service:
PG_PASS_secret=db_password
Please note the '_secret' suffix. Value should be set to secret's name.
- Load script in your entrypoint or command script:
#!/bin/bash
source ./rancher-secrets.sh
echo Value of \$PG_PASS is \"$PG_PASS\"