title: Scala way choosing configuration regarding different environment
body: <p>My application needs to read configuration file either from the resource directory or from s3.</p>
  
  <p>For local development, I need to read it from the local resource directory.  So, when build my project, I don't put the configuration file <code>config.properties</code> into my application jar file.  In this case, it should read the configuration from S3.  When I can think of doing this scala is pretty much like what I do it by java</p>
  
  <pre><code>val stream : InputStream = getClass.getResourceAsStream("/config.properties")
  if (stream != null) {
    val lines = scala.io.Source.fromInputStream( stream ).getLines
  } else {
    /*read it from S3*/
  }
  </code></pre>
  
  <p>But I think scala gives a more functional programing sytax.  Any advice?</p>