Last active
July 15, 2018 23:53
-
-
Save xerial/0b6b18b721c1b0b323ae85e418090bb5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// New Services | |
class WebApp(webAppConfig:WebAppConfig, component:WebComponent) | |
class WebComponent(service:Service) | |
// Pack configuration set in a class | |
case class ConfigSet(serviceConfig:ServiceConfig, webAppConfig:WebAppConfig) | |
// Read configurations from a YAML file | |
def readConfig: ConfigSet = { | |
val yaml = readConfig("config.yml") | |
val serviceConfig = new ServiceConfig(yaml.get(...), yaml.get(..)) | |
val webAppConfig = new WebAppConfig(...) | |
ConfigSet(serviceConfig, webAppConfig) | |
} | |
// Initialize services | |
val configSet = readConfig | |
val service = new Service(configSet.serviceConfig) | |
val webComponent = new WebComponent(service) | |
val webApp = new WebApp(configSet.webAppConfig, webComponent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment