title: How to read environment variables in TypeSafe config in scala?
body: <p>I am trying to read the environment variables in typesafe config in scala, configuring the slick database. Here is what I tried</p>
  
  <pre><code>remote_test_db = {
    dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
    properties = {
      driver = "org.postgresql.Driver"
      url = ${?REMOTE_TEST_DB_URL}
      user = ${?REMOTE_TEST_DB_USERNAME}
      password = ${?REMOTE_TEST_DB_PASSWORD}
    }
    connectionPool = disabled
    keepAliveConnection = true
  }
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
      at com.flyhomes.mls_pull.dump.MlsProvider.main(MlsProvider.scala)
  Caused by: com.typesafe.config.ConfigException$NotResolved: need to Config#resolve(), see the API docs for Config#resolve(); substitution not resolved: ConfigConcatenation(${?REMOTE_TEST_DB_USERNAME})
      at com.typesafe.config.impl.ConfigConcatenation.notResolved(ConfigConcatenation.java:51)
      at com.typesafe.config.impl.ConfigConcatenation.valueType(ConfigConcatenation.java:58)
      at slick.util.ConfigExtensionMethods$$anonfun$slick$util$ConfigExtensionMethods$$toProps$1$1.apply(GlobalConfig.scala:71)
      at slick.util.ConfigExtensionMethods$$anonfun$slick$util$ConfigExtensionMethods$$toProps$1$1.apply(GlobalConfig.scala:69)
      at scala.collection.Iterator$class.foreach(Iterator.scala:893)
      at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
      at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
      at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      at slick.util.ConfigExtensionMethods$.slick$util$ConfigExtensionMethods$$toProps$1(GlobalConfig.scala:69)
      at slick.util.ConfigExtensionMethods$.toProperties$extension(GlobalConfig.scala:78)
      at slick.util.ConfigExtensionMethods$.getPropertiesOr$extension(GlobalConfig.scala:64)
      at slick.util.ConfigExtensionMethods$.getPropertiesOpt$extension(GlobalConfig.scala:84)
      at slick.jdbc.DataSourceJdbcDataSource$.forConfig(JdbcDataSource.scala:90)
      at slick.jdbc.DataSourceJdbcDataSource$.forConfig(JdbcDataSource.scala:86)
      at slick.jdbc.JdbcDataSource$.forConfig(JdbcDataSource.scala:48)
      at slick.jdbc.JdbcBackend$DatabaseFactoryDef$class.forConfig(JdbcBackend.scala:288)
      at slick.jdbc.JdbcBackend$$anon$3.forConfig(JdbcBackend.scala:33)
      at com.flyhomes.mls_pull.Databases$.remoteTestDb$lzycompute(Databases.scala:21)
      at com.flyhomes.mls_pull.Databases$.remoteTestDb(Databases.scala:21)
      at com.flyhomes.mls_pull.dump.MlsProvider$.&lt;init&gt;(MlsProvider.scala:18)
      at com.flyhomes.mls_pull.dump.MlsProvider$.&lt;clinit&gt;(MlsProvider.scala)
      ... 1 more
  </code></pre>
  
  <p>How do I access the environment variables here?</p>