V
V
Vladimir Dementiev2020-06-01 11:15:43
JavaScript
Vladimir Dementiev, 2020-06-01 11:15:43

How to properly organize the assembly of a java web project?

Good afternoon!

I have a cluster on IBM Websphere and an IS that I administer. To simplify some actions, I wrote a small web application through which I can monitor some parameters on each server. And also execute some commands. An instance of the application is running on each node and works fine through the balancer.
FrontEnd is written in javascript, and in java servlets that return JSON.
The problem is that at the front (i.e., on JS), the call to REST services for each node is hardcoded.
I set up the project build on the server through the internal gitlab + maven repository with subsequent deployment.

And in case I need to run the application on a test one, then I will have to make edits in the js file.
Although I brought this into separate functions, it gets boring every time to make edits in js. Yes, and quite often I forget about it. And then with the debugger, I notice that calls from the JS of the test server go to prod. And when deploying to production, again do not forget to fix js.

Actually, the question is brewing:
What can be done to make the application more universal?
Those. to remove "hardcode" from JS. For example, before building the WAR file on the server, were changes automatically made to the js file from the prepared config individually for each environment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2020-06-02
@alfss

You can read the config from the /conf.json file, where the script itself is located, the script can be managed through nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question