This Ruby example checks if the environment variables DEMO_USERNAME
and DEMO_PASSWORD
have been set. If that's the case, you'll receive a 200
on http://localhost:8080 and if it's not, you'll get a 500
.
- Docker installed and running
- SecretHub installed
- A SecretHub repo that contains a
username
andpassword
secret. To create it, runsecrethub demo init
.
Set the SecretHub username in an environment variable
export SECRETHUB_USERNAME=<your-username>
Create a service account for the demo repo
secrethub service init --description demo_service \
--permission read --file demo_service.cred ${SECRETHUB_USERNAME}/demo
Build the ruby docker demo
docker build . -t ruby-secrethub-demo
Run the docker demo with the secrets in the environment variables
docker run -ti -p 8080:4567 \
-e DEMO_USERNAME=secrethub://${SECRETHUB_USERNAME}/demo/username \
-e DEMO_PASSWORD=secrethub://${SECRETHUB_USERNAME}/demo/password \
-e SECRETHUB_CREDENTIAL=$(cat demo_service.cred) \
ruby-secrethub-demo
If you now visit http://localhost:8080, you should see the welcome message including your username.