blob: 112986ee82b1a31fb6a74e062994853fb75b4c61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package xyz.driver.core
import java.io.File
import com.typesafe.config.{Config, ConfigFactory}
object config {
def loadDefaultConfig: Config = {
val configDefaults = ConfigFactory.load(this.getClass.getClassLoader, "application.conf")
scala.sys.props.get("application.config") match {
case Some(filename) =>
val configFile = new File(filename)
if (configFile.exists()) {
ConfigFactory.parseFile(configFile).withFallback(configDefaults)
} else {
throw new IllegalStateException(s"No config found at $filename")
}
case None => configDefaults
}
}
}
|