With reference to this recent addition to next-gen Lucee:
add system properties and system environments setting to server scope
[LDEV-344] - LuceeLDEV-344 #deployed
https://bitbucket.org/lucee/lucee/commits/50015c1c9e6bd578804bf2690ecaea78c639221e
This creates two structs under the server scope:
- server.system.environment; for all the local OS environment variables puled from enumerating
System.getEnv()
- server.system.properties; for all the JVM system properties pulled from enumerating
System.getProperties()
Firstly, i think this is a great idea. While at first it feels icky to stick anything into the server scope, upon reflection it seems like an elegant way of doing a little bit of plumbing we’d otherwise have to do in the Application.cfc
constructor. It’s a wonder this hasn’t always been part of server scope as it feels very CFML.
The general nomenclature is environment variables and system properties so I can understand the naming decision. However, both come from the System
class, and the names are often used interchangeably; for example, JVM environment properties. This has caused considerable debate amongst the developers in our office – naming things is always hard.
A less ambiguous naming of the variable scopes might be:
- server.env; marries up to the function call
System.getEnv()
- server.properties; marries up to the function call
System.getProperties()