Skip to content

Stop bundling environment.ts files (treat as a loose asset) #6688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Jun 15, 2017 · 4 comments
Closed

Stop bundling environment.ts files (treat as a loose asset) #6688

ghost opened this issue Jun 15, 2017 · 4 comments
Assignees
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion severity2: inconvenient

Comments

@ghost
Copy link

ghost commented Jun 15, 2017

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

N/A

Repro steps.

N/A

The log given by the failure.

N/A

Desired functionality.

We frequently add environment variables to the environment.ts file ... surprise!. We use the standard development and production builds but either can be deployed to any number of sites: Company A host, Company B host... and each host may have its own environment settings.

Mention any other details that might be useful.

Each site has its own environment settings (for example each site may point to a different host for API calls). Since the environment files are bundled we either have to rebuild and specify another environment file for each build (not going to do that) or perform variable substitutions on bundle files (holding our noses and doing that). The environment files should be loose (not bundled) so tools like Ansible or your own shell scripts can more safely and efficiently change the values as part of the deployment.

@Brocco Brocco added P5 The team acknowledges the request but does not plan to address it, it remains open for discussion severity2: inconvenient feature Issue that requests a new feature labels Jun 15, 2017
@clydin
Copy link
Member

clydin commented Jun 16, 2017

A potential solution to support scenarios such as this is to ship a json file containing the settings which are dynamic. On application startup, this file can be fetched and then used to configure the app as appropriate.

Another option is to provide a script (configured within angular-CLI.json) which will define global variables which can then be used by the application.

@ghost
Copy link
Author

ghost commented Jun 16, 2017

Everything in the environment file is potentially "dynamic" (by definition) so it would be simpler to load everything with a remote resource (json or otherwise). Bundling environment.ts really misses the mark on the basic notion of build != deploy where you want to build once and deploy anywhere.

Using a remote resource really just throws away the Angular environment scheme that's in place now as it's impractical to use in a typical automated deployment situation. I would rather keep that but in a way that supports post-build deployment.

@filipesilva
Copy link
Contributor

What you're asking for is a fundamentally different feature than what --environment provides. There is more discussion about this topic in #3855 (comment).

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion severity2: inconvenient
Projects
None yet
Development

No branches or pull requests

3 participants