Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val logConfigurationFile = System.getenv("PETCLINIC_HOME") + "/logback.xml"
- val context: LoggerContext = LoggerFactory.getILoggerFactory.asInstanceOf[LoggerContext]
- val jc: JoranConfigurator = new JoranConfigurator()
- context.reset()
- context.putProperty("application-name", "PetClinic")
- jc.setContext(context)
- jc.doConfigure(logConfigurationFile)
- lazy val appPropertyFilePath = System.getenv("PETCLINIC_HOME") + "/app.properties"
- lazy val properties: Properties = {
- val properties = new Properties()
- properties.load(new FileInputStream(appPropertyFilePath))
- properties
- }
- lazy val projectUrl: String = properties.getProperty("project.url")
- lazy val projectEmail: String = properties.getProperty("project.email")
- lazy val appUrl: String = properties.getProperty("app.url")
- lazy val mysqlUsername: String = properties.getProperty("mysql.username")
- lazy val mysqlPassword: String = properties.getProperty("mysql.password")
- lazy val mysqlDatabaseName: String = properties.getProperty("mysql.database.name")
- lazy val mysqlServerName: String = properties.getProperty("mysql.server.name")
- lazy val mysqlCachePrepStmts: Boolean = properties.getProperty("mysql.cachePrepStmts").toBoolean
- lazy val mysqlPrepStmtCacheSize: Int = properties.getProperty("mysql.prepStmtCacheSize").toInt
- lazy val mysqlPrepStmtCacheSqlLimit: Int = properties.getProperty("mysql.prepStmtCacheSqlLimit").toInt
- lazy val mysqlUseServerPrepStmts: Boolean = properties.getProperty("mysql.useServerPrepStmts").toBoolean
- lazy val casUrl: String = properties.getProperty("cas.url")
- lazy val casPort: Int = properties.getProperty("cas.port").toInt
- lazy val casKeyspace: String = properties.getProperty("cas.keyspace")
- lazy val hazelcastGroupName: String = properties.getProperty("hazelcast.group.name")
- lazy val hazelcastGroupPassword: String = properties.getProperty("hazelcast.group.password")
- lazy val hazelcastLoggingType: String = properties.getProperty("hazelcast.logging.type")
- lazy val smtpUrl: String = properties.getProperty("smtp.url")
- lazy val smtpPort: Int = properties.getProperty("smtp.port").toInt
- lazy val smtpUserName: String = properties.getProperty("smtp.username")
- lazy val smtpPassword: String = properties.getProperty("smtp.password")
- lazy val smtpSslOnConnect: Boolean = properties.getProperty("smtp.sslonconnect").toBoolean
- lazy val googleWebClientId: String = properties.getProperty("google.webclient.id")
- lazy val googleWebClientSecret: String = properties.getProperty("google.clientweb.secret")
- lazy val appEmail: String = properties.getProperty("app.email")
- lazy val appName: String = properties.getProperty("app.name")
- def initialize():Unit = {
- //TODO do initialization
- }
- def cleanup():Unit = {
- //TODO do cleanup
- }
- lazy val restApi = new RestApi(cassandraSession, eventBus, userApi, ownerApi, petApi, authenticationApi)
- lazy val swaggerApiDocServlet = new SwaggerApiDocServlet(projectUrl, projectEmail)
- override def init(context: ServletContext) {
- context.mount(restApi, "/api/*") // mount servlets
- context.mount(swaggerApiDocServlet, "/api-doc/*") // mount servlets
- initialize()
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement