How about this ...
I've just discovered Props.whereToLook, which prepends to the list of places that Props looks for files.
I also want to solve the problem of how to have multiple apps running in the same jetty instance, but each with their own props file that is editable without having to recompile the war.
So, the plan is:
1) pass the jetty resources dir as a system parameter when you start jetty: java -Djetty.resource.dir=$JETTY_HOME/resources -jar start.jar
2) within the jetty resource dir, create a sub directory for each app running in jetty (make the name of the the dir the same as the context root)
3) put a props file in this sub directory following the same naming options as the usual Props file, (modename.username.hostname.props, etc)
3) put this code into your boot.scala:
val contextPath = LiftRules.context match {
case c: HTTPServletContext => Full(c.path)
case _ => Empty
}
info("Context Path is: " + contextPath )
val jettyResourceDir = Box.!!(System.getProperty("jetty.resource.dir"))
info("got jetty.resource.dir from system properties: " + jettyResourceDir)
val whereToLook = jettyResourceDir.flatMap( dir => {
contextPath.map( cp =>
for (
propsname <- Props.toTry;
fullname = dir + cp + propsname() + "props";
file = new File(fullname);
if (file.exists)
) yield fullname -> { () => Full(new FileInputStream(file))}
)
})
whereToLook.foreach( w =>
Props.whereToLook = () => w )
Seems to work, although I can't help thinking there must be a more elegant solution.
Is this one for the Cookbook, possibly?