|
I am using docker-compose to run my app locally for dev and want to be able to have a token available at startup to remove the manual step of generating a token and then adding it and starting my app. My workaround to make it work was to write a startup script for my redis container to add the tokens so the keys are set and ready for when Quirrel goes looking for them. This works but I was hoping there was a better way, maybe like a docker-compose.yml version: "3"
services:
app:
environment:
NODE_ENV: development
QUIRREL_API_URL: http://queue:9181
QUIRREL_TOKEN: "dad998c8-0c69-4e02-9ee6-7063da318420"
QUIRREL_BASE_URL: localhost:3000
QUIRREL_ENCRYPTION_SECRET: "4482546e671ad0347b3ff74f62869399"
....
queue:
environment:
PASSPHRASES: "da40b88cb5816ae66274f062bcbc3a9e"
REDIS_URL: redis://redis
QUIRREL_ENCRYPTION_SECRET: "4482546e671ad0347b3ff74f62869399"
depends_on:
- redis
image: ghcr.io/quirrel-dev/quirrel:main
ports:
- 9181:9181
restart: always
redis:
environment:
QUIRREL_TOKEN: "dad998c8-0c69-4e02-9ee6-7063da318420"
build:
dockerfile: Dockerfile.redis.dev
ports:
- 6379:6379Dockerfile.redis.dev redis-dev-start #!/bin/bash
echo "--- Starting the Redis server"
redis-server &
echo "--- Waiting for Redis to be available ping Redis... "
PONG=`redis-cli ping | grep PONG`
while [ -z "$PONG" ]; do
sleep 1
PONG=`redis-cli ping | grep PONG`
done
echo "--- Adding dev token to Redis"
echo "hset tokens:id-token app $QUIRREL_TOKEN" | redis-cli
echo "hset tokens:token-id $QUIRREL_TOKEN app" | redis-cli
while true; do sleep 1; done |
Answered by
Skn0tt
Apr 19, 2022
Replies: 1 comment 1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For local dev, you can use unauthenticated mode. Keep
PASSPHRASESempty (or omit it), and then everything should work even without a token. (if you want to see how it works in the code, start here)