Skip to content

Instantly share code, notes, and snippets.

View dbiswa4's full-sized avatar

Dipankar Biswas dbiswa4

  • Bay Area
View GitHub Profile
@DanielaSfregola
DanielaSfregola / MyConfig.scala
Last active March 20, 2022 18:33
A simple script that will try to load configurations in the following order: 1) From properly named environment variables 2) From command line paramenters 3) From the configuration file. See article http://danielasfregola.com/2015/06/01/loading-configurations-in-scala/
import com.typesafe.config.ConfigFactory
import scala.util.Properties
class MyConfig(fileNameOption: Option[String] = None) {
val config = fileNameOption.fold(
ifEmpty = ConfigFactory.load() )(
file => ConfigFactory.load(file) )
def envOrElseConfig(name: String): String = {