This Perfect example checks if the environment variables DEMO_USERNAME
and DEMO_PASSWORD
have been set. If that's not the case, you'll receive an error message on http://localhost:8181.
- 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 Perfect docker demo
docker build . -t perfect-secrethub-demo
Run the docker demo with the secrets in the environment variables
docker run -p 8181:8181 \
-e DEMO_USERNAME=secrethub://${SECRETHUB_USERNAME}/demo/username \
-e DEMO_PASSWORD=secrethub://${SECRETHUB_USERNAME}/demo/password \
-e SECRETHUB_CREDENTIAL=$(cat demo_service.cred) \
perfect-secrethub-demo
If you now visit http://localhost:8181, you should see the welcome message including your username.