title: How to change Play 2 Framework DB configuration at runtime?
body: <p>We are using Play 2.1.1 and its built-in JPA integration (JPA.em() 
  etc). </p>
  
  <ul>
  <li>How can we dynamically change the db.pass property? Play.application().configuration() seems 
  to be immutable as of Play 2.1. (or we're at least not aware of the mutators)</li>
  <li>If we are able to change db.pass, how can we reload the DB configuration so that JPA.em() returns an EntityManager using the new password?</li>
  </ul>
  
  <p>What we are trying to avoid is having to recreate the EntityManager using 
  EntityManagerFactory.  We want to continue to let Play manage that in 
  the JPA helper class.</p>
  
  <p><em><strong>Background</em></strong></p>
  
  <p>The system has a default DB configuration for running locally.  When deployed to a server, the DB password is dynamically set on the running application using the following script: </p>
  
  <pre><code>#!/bin/bash 
  stty -echo 
  read -p "Password: " PASS 
  stty echo 
  curl -k https://127.0.0.1:8443/someUrl/pwd --data "password=$PASS" 
  </code></pre>
  
  <p>The application receives this data and then recreates the Hibernate 
  SessionFactory.  Our new Play app will be required to do something 
  similar.  </p>