Skip to content

Commit

Permalink
enforce env var LUCEE_ADMIN_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Aug 6, 2024
1 parent eaa54b1 commit 14142b7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3582,8 +3582,23 @@ private static void _loadUpdate(ConfigServer configServer, Config config, Struct
* @param doc
*/
private static void _loadAdminMode(ConfigServerImpl config, Struct root) {
config.setAdminMode(
ConfigWebUtil.toAdminMode(getAttr(root, "mode"), Caster.toShortValue(SystemUtil.getSystemPropOrEnvVar("lucee.admin.mode", null), ConfigImpl.ADMINMODE_SINGLE)));
final short undefined = -1;
short am = undefined;

// force by env var
String str = SystemUtil.getSystemPropOrEnvVar("lucee.admin.mode", null);
if (!StringUtil.isEmpty(str, true)) {
am = ConfigWebUtil.toAdminMode(str, undefined);
}

// when not forced
if (am == undefined) {
am = ConfigWebUtil.toAdminMode(getAttr(root, "mode"), undefined);
if (am == undefined) {
am = ConfigWebUtil.toAdminMode(SystemUtil.getSystemPropOrEnvVar("lucee.admin.mode.default", null), ConfigImpl.ADMINMODE_SINGLE);
}
}
config.setAdminMode(am);
}

private static void _loadSetting(ConfigServerImpl configServer, ConfigImpl config, Struct root, Log log) {
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.0.4.4-SNAPSHOT"/>
<property name="version" value="6.0.4.5-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.0.4.4-SNAPSHOT</version>
<version>6.0.4.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 14142b7

Please sign in to comment.