Skip to content

Commit 03b5753

Browse files
shawkinsPepo48
andauthored
enhance: add KC_ env variables for verbose and .sh options (keycloak#41847)
* enhance: add KC_ env variables for verbose and .sh options closes: keycloak#19213 Signed-off-by: Steve Hawkins <[email protected]> Signed-off-by: Peter Zaoral <[email protected]> Co-authored-by: Peter Zaoral <[email protected]>
1 parent 75078e0 commit 03b5753

File tree

3 files changed

+25
-10
lines changed
  • quarkus
    • dist/src/main/content/bin
    • runtime/src/main/java/org/keycloak/quarkus/runtime/cli/command

3 files changed

+25
-10
lines changed

quarkus/dist/src/main/content/bin/kc.bat

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,30 @@ if not "x%JAVA_OPTS_APPEND%" == "x" (
140140
set JAVA_OPTS=%JAVA_OPTS% %JAVA_OPTS_APPEND%
141141
)
142142

143-
if NOT "x%DEBUG%" == "x" (
144-
set DEBUG_MODE=%DEBUG%
143+
if NOT "x%KC_DEBUG%" == "x" (
144+
set DEBUG_MODE=%KC_DEBUG%
145+
) else (
146+
if NOT "x%DEBUG%" == "x" (
147+
set DEBUG_MODE=%DEBUG%
148+
)
145149
)
146150

147-
if NOT "x%DEBUG_PORT%" == "x" (
148-
set DEBUG_PORT_VAR=%DEBUG_PORT%
151+
if NOT "x%KC_DEBUG_PORT%" == "x" (
152+
set DEBUG_PORT_VAR=%KC_DEBUG_PORT%
153+
set DEBUG_ADDRESS=0.0.0.0:!DEBUG_PORT_VAR!
154+
) else (
155+
if NOT "x%DEBUG_PORT%" == "x" (
156+
set DEBUG_PORT_VAR=%DEBUG_PORT%
157+
set DEBUG_ADDRESS=0.0.0.0:!DEBUG_PORT_VAR!
158+
)
149159
)
150160

151-
if NOT "x%DEBUG_SUSPEND%" == "x" (
152-
set DEBUG_SUSPEND_VAR=%DEBUG_SUSPEND%
161+
if NOT "x%KC_DEBUG_SUSPEND%" == "x" (
162+
set DEBUG_SUSPEND_VAR=%KC_DEBUG_SUSPEND%
163+
) else (
164+
if NOT "x%DEBUG_SUSPEND%" == "x" (
165+
set DEBUG_SUSPEND_VAR=%DEBUG_SUSPEND%
166+
)
153167
)
154168

155169
rem Set debug settings if not already set

quarkus/dist/src/main/content/bin/kc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ SERVER_OPTS="$SERVER_OPTS -Dpicocli.disable.closures=true"
4141
SERVER_OPTS="$SERVER_OPTS -Dquarkus-log-max-startup-records=10000"
4242
CLASSPATH_OPTS="'$(abs_path "../lib/quarkus-run.jar")'"
4343

44-
DEBUG_MODE="${DEBUG:-false}"
45-
DEBUG_PORT="${DEBUG_PORT:-8787}"
46-
DEBUG_SUSPEND="${DEBUG_SUSPEND:-n}"
44+
DEBUG_MODE="${KC_DEBUG:-${DEBUG:-false}}"
45+
DEBUG_PORT="${KC_DEBUG_PORT:-${DEBUG_PORT:-8787}}"
46+
DEBUG_SUSPEND="${KC_DEBUG_SUSPEND:-${DEBUG_SUSPEND:-n}}"
4747
DEBUG_ADDRESS="0.0.0.0:$DEBUG_PORT"
4848

4949
esceval() {

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/command/Main.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public final class Main {
8888
@Option(names = { "-v", "--verbose" },
8989
description = "Print out error details when running this command.",
9090
paramLabel = NO_PARAM_LABEL,
91-
scope = ScopeType.INHERIT)
91+
scope = ScopeType.INHERIT,
92+
defaultValue = "${env:KC_VERBOSE}")
9293
public void setVerbose(boolean verbose) {
9394
ExecutionExceptionHandler exceptionHandler = (ExecutionExceptionHandler) spec.commandLine().getExecutionExceptionHandler();
9495
exceptionHandler.setVerbose(verbose);

0 commit comments

Comments
 (0)