I use this to configure the database:
val vendor =
new StandardDBVendor(
Props.get("db.driver") openOr "org.h2.Driver",
Props.get("db.url") openOr "jdbc:h2:mem:db;AUTO_SERVER=TRUE",
Props.get("db.user"),
Props.get("db.password"))
LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
The "supports" referenced will be (by default) in the default.props file in the props directory in the resources.
Updated . This is what I do on servers in production. Using "Props.whereToLook" you provide a function that retrieves the configuration input stream. It can be a file, as in the example below, or you can, for example, extract it through a network socket.
You probably run the application with an error.
val localFile = () => {
val file = new File("/opt/jb/myapp/etc/myapp.props")
if (file.exists) Full(new FileInputStream(file)) else Empty
}
Props.whereToLook = () => (("local", localFile) :: Nil)
source
share