I'm currently in the process of developing an angular application that interacts with a REST API
on the backend server. The URL for this server is currently set as an environment variable like so:
export const environment = {
production: false,
loggerLevel: NgxLoggerLevel.DEBUG,
disableConsoleLogging: false,
lang: 'en',
api: {
. //other variables
.
.
host: "http://mycoolurl.com/rest/v11_1/",
.
. //more variables
.
}
};
A similar question addressing this issue can be found here. However, it involves using a specific settings.json file fetched via APP INITIALIZER
. Another related query can be viewed here, recommending the use of a separate JSON file.
A recent change request now demands that users have the ability to specify the target URL for the REST
calls. Ideally, this should be facilitated through an input field where users can enter the desired URL, updating the host in the environment file accordingly. So, how do I go about achieving this?
Regrettably, completely revamping the implementation and removing the host from the environment file is not feasible, considering its widespread usage across the application.