Created
April 10, 2018 08:03
-
-
Save anderssv/528c7fdb3538c44ca6efec6874010d68 to your computer and use it in GitHub Desktop.
Dependency Injection Blog - Load Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun loadConfig(randomPort: Boolean = false): DependencyInjectionApplicationConfig { | |
val properties = loadRuntimeProperties() | |
return DependencyInjectionApplicationConfig( | |
if (randomPort) 0 else requiredEnv(properties, "PORT", "5000").toInt(), | |
requiredEnv(properties, "DATABASE_URL"), | |
env(properties, "DATABASE_USER") | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment