title: SBT - How can I add/modify values to application.conf file based on an external source
body: <p>I read that <code>SBT</code> has functionality to <a href="https://www.scala-sbt.org/1.0/docs/Howto-Generating-Files.html" rel="nofollow noreferrer">generate source code and resource files</a>.</p>
  
  <p>In my case I want to add/modify a field in an <code>application.conf</code> file during compilation/packaging of the project (leaving the others in place)</p>
  
  <p>For instance my application.conf file has something like:</p>
  
  <pre><code>A {
    B = "Some Value"
    C = "Some value to be modified"
  }
  </code></pre>
  
  <p>I would like in the SBT to read an external file and change or add the value of A.B or A.C</p>
  
  <p>So if it is possible to do something along the lines of:</p>
  
  <pre><code>build.sbt
  
  lazy val myProject = project.in(file('myproject')
  // pseudo code - How do I do this?
  .sourceGenerators in Compile += "Read file /path/to/external/file and add or replace the value of application.conf A.B = some external value"
  </code></pre>