Skip to content

Provide a Way to Use Runtime Environment Variables #5309

Closed
@tim273

Description

@tim273

Currently angular-cli has the environment option, which works great for setting environment variables at build time, but I have a requirement to use environment variables at run time. So I am sent a header from an Apache server called 'X-Environment' which contains 'dev', 'qa', 'prod', etc, and then at I use that to determine which environment variables to use. The reasoning for this is that the build team at my work wants a single deployable file (what's in the dist folder zipped up) that is built once and and deployed to multiple environments. They also want to control environment properties as much as possible using CMDB and minimize having hard coded environment variables.

All the searching I've done provides solutions about setting environment variables at build time, but none at run time. It would be nice something were built in angular-cli to make this happen, rather than having to do it manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions