I need to set an environment variable before my init system actually starts other services, These services are baked into an AMI and use environment variables to run commands. In my case init system can be either upstart or systemd.
For setting environment I need to fetch that value of environment from a URL and then set the system environment variables so that other services can access that value when they start.
Essentially, I need to know where how i can set these environment variables so that they run before systemd or upstart starts the services.
OS - Ubuntu(14.04 or 16.10) and The services are running on Amazon EC2.
I you put your service into docker, than at start up command you can add curl for envs (or add it inside your app if ou are delveloper)
If you use kubernetiss, you also you can add readiness probe, to check that envs is successfully fetched
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/