Is there a way to get (and use) an environment variable in a template file? I would like to add a JavaScript call to my html.html.twig file, but there are two separate .js sources depending on which environment I'm on (production, and non-production). I believe Acquia Cloud (which we use) provides such variables, but they are for PHP.

I'm still relatively new to Drupal 8, so I might be missing something obvious with this. Is there a way to use Acquia Cloud's environment variables in a template file?

I forgot to mention that I tried accessing the environment variables from a few preprocess functions, for example themename_preprocess_html() and themename_preprocess_page(), but they are apparently not set at all.
So I guess my problem was that I was on a Local environment, where Acquia does not provide any environment variables. I had to push my test code to Dev in order to see any effect.