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.
![](https://aemconcepts.com/wp-content/uploads/2023/04/image-2-1024x739.png)
Inside your dispatcher SDK create a environment variables file env/variables.txt
![](https://aemconcepts.com/wp-content/uploads/2023/04/image-1024x420.png)
Update the docker_run.sh
to include the environment variables file
Include envfile variable to reference your environment file location.
![](https://aemconcepts.com/wp-content/uploads/2023/04/image-1-1024x420.png)
Include the envfile variable in the docker run command.
![](https://aemconcepts.com/wp-content/uploads/2023/09/image-1024x229.png)
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
.
Thanks for putting this together and including the screens, this is very helpful.