Use environment variables with local docker dispatcher in AEMaaCS

In AEMaaCS you can set environment variables using adobe IO CLI and use them in dispatcher using ${var}. But how do you do the same with the local dispatcher SDK.

This is fairly simple to do. All you need to do is associate your docker_run with your env variables file. Lets see how!

Local dispatcher SDK uses docker_run.sh to run the dispatcher in a docker container. Since the local dispatcher runs in docker container the environment variables also need to be set in the container itself.

Lets take an example of an ENV_NAME environment variable used in your dispatcher configs.

Inside your dispatcher SDK create a environment variables file env/variables.txt

Update the docker_run.sh to include the environment variables file
Include envfile variable to reference your environment file location.

Include the envfile variable in the docker run command.

Now start your dispatcher as usual using docker run.

./bin/docker_run.sh ./src docker.for.mac.localhost:4503 80

Docker container will pick the environment variables from the env/variables.txt.

1 Comment

  1. Randeep Singh

    Thanks for putting this together and including the screens, this is very helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *