In projects I work(ed) on, deployment parameters - such as storage path or DB login - are usually given through a parameter file, which is stored in the war file.
I find that unsuitable because those values needs to be changed each time the webapp is packaged for a different deployment (dev vs prod, change of executing computer). The source code being versioned, this makes it even more bothering.
Is there some better option to pass parameters such as listed above?
By better, I mean:
- practical: simple to setup, change and explain to others
- separated from the war
- as independent as possible to the web container (if dependent, I'm using tomcat in prod)
Edit
I chose the answer of @aksappy to reward the work done in the answer and because it provided several methods using standard tools. However, depending on the context I could go for any other solutions:
- method of @Necreaux has best simplicity
- method of @Luiggi Mendoza has a good design and is still simple
- method of @OldCurmudgeon would be a really good one if the code covered other cases.