As the comment from Chris Nauroth says, best practice is to keep environment-specific configuration out of the WAR.
However if you are stuck with the configuration being in that WAR, then you can use zip tools to update the configuration file.
If you are on a typical Linux distribution, then assuming your WAR file is called application.war
and the configuration file you want to update is WEB-INF/classes/com/example/config.properties
then you can run these commands during your deployment before you start Tomcat:
unzip application.war WEB-INF/classes/com/example/config.properties
# edit the configuration file now
zip -f -m application.war WEB-INF/classes/com/example/config.properties
After the unzip command, the file will be in a subfolder matching its location in the WAR (eg WEB-INF/classes/com/example/config.properties
) and then the second zip command will delete it from the disk and put it back into the WAR.
I'm not familiar with Chef so I'm not sure how to run those commands automatically as part of the deployment, but presumably it provides a way to run command directly like this.