Is there a way to get (and use) an environment variable in my Twig template?

by TerranRich   Last Updated January 12, 2018 22:07 PM

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, there a way to use Acquia Cloud's environment variables in a Twig template?

(EDIT) I forgot to mention that I tried accessing the environment variables from a few preprocess hook functions, e.g. themename_preprocess_html() and themename_preprocess_page(), but they are apparently not set at all.

Related Questions

Drupal and Git workflow using Acquia cloud

Updated February 26, 2016 05:03 AM

How to manage acquia website in Lamp environment?

Updated March 15, 2017 12:07 PM