Lucee 5 has been out for nearly a year and a half now, but various critical issues have prevented us from completing our upgrade from 4.5. Happily these problems seem to have been resolved and the current version is looking very stable in production.
Most of the development effort in version 5 went into rewriting the engine from the ground up around the OSGi model, so the number of new features is small. But there are a few improvements worth noting and I'm expecting this to be the first in a short series of posts on what I'm finding useful.
I first became aware of the importance of using environment variables (or "env vars") for configuration in the 12 factor app. but it's taken me a while to appreciate their value in decoupling the code base from its deployment environment.
Prior to Lucee 5, accessing env vars wasn't difficult but did mean reaching into the underlying java:
system = CreateObject( "java", "java.lang.System" ); dbPassword = system.getEnv( "DB_PASSWORD" );
In version 5, Lucee exposes all system env vars in a new
environment struct in the
server scope. So to get our db password we now just need:
dbPassword = server.system.environment.DB_PASSWORD;