I’ve tried looking through all of the available documentation on using the environment variables and can’t find anything about using the environment variables in the Run Command for your App/Component. I want to store some encrypted values in the environment variables and pass those in arguments with there run command after deploying an App. I am deploying a Worker, using a Docker image and my run command looks like this:
imapsync --user1 $USER1 --password1 $PASSWORD1 --user2 $USER2 --password2 $PASSWORD2 --subfolder2 $USER1 --gmail1 --gmail2
I want all of those variables to be environment variables that are passed in when run.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This is what I ultimately ended up with creating: https://github.com/timnolte/imapsync-worker
And my App Spec looks like this:
Hello,
I have just tested this and it seems to be working.
Are you defining the scope of your environment variables as per the documentation here:
https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/#define-build-time-environment-variables
If so, you need to make sure that you’ve also defined the variables to have a
RUN_TIME
scope so that you could use them for your run commands:Or alternatively, if you need the environment variables for both the run and the build times, you could use
RUN_AND_BUILD_TIME
.I tested this with the following simple deployment:
Best,
Bobby