title: In the Pyramid web framework, how do I source sensitive settings into development.ini / production.ini from an external file?
body: <p>I'd like to keep <code>development.ini</code> and <code>production.ini</code> under version control, but for security reason would not want the <code>sqlalchemy.url</code> connection string to be stored, as this would contain the username and password used for the database connection.</p>
  
  <p>What's the canonical way, in Pyramid, of sourcing this setting from an additional external file?</p>
  
  <p><strong>Edit</strong>
  In addition to solution using the environment variable, I came up with this solution after asking around on #pyramid:</p>
  
  <pre><code>def main(global_config, **settings):
  """ This function returns a Pyramid WSGI application.
  """
  # Read db password from config file outside of version control
  secret_cfg = ConfigParser()
  secret_cfg.read(settings['secrets'])
  dbpass = secret_cfg.get("secrets", "dbpass")
  settings['sqlalchemy.url'] = settings['connstr'] % (dbpass,)
  </code></pre>