title: Runtime Configuration for Angular 6+ Applications
body: <p>What is the recommended best practice for loading environment specific configuration during runtime of an Angular application?  The Angular documentation mentions the use of APP_INITIALIZER, but that is still not early enough in the load process for things such as runtime configuration of imported modules that make use of the .forRoot() convention.  </p>
  
  <p>In my use case, I have an authentication service built and imported via a Core module, which is imported by the App module.  The authentication library I am using (the <a href="https://github.com/manfredsteyer/angular-oauth2-oidc" rel="noreferrer">angular-oauth2-oidc</a> library) allows for configuration of the automatic appending of access tokens during when importing the module (see <a href="https://github.com/manfredsteyer/angular-oauth2-oidc#calling-a-web-api-with-an-access-token" rel="noreferrer">this segment</a>).  Since there are constraints in the build environment I am working with that only allows me to produce one common build package to deploy to all environments, I am unable to dynamically set values by using different environment.ts files.</p>
  
  <p>One initial idea is to use the fetch API on the index.html page to load a JSON file containing the configuration onto a global variable, but since the call is asynchronous, there is a chance the configuration will not be fully loaded when the import of the Core module occurs.</p>