[
https://issues.apache.org/jira/browse/KNOX-3122?focusedWorklogId=965236&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-965236
]
ASF GitHub Bot logged work on KNOX-3122:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Apr/25 14:28
Start Date: 08/Apr/25 14:28
Worklog Time Spent: 10m
Work Description: smolnar82 commented on code in PR #1018:
URL: https://github.com/apache/knox/pull/1018#discussion_r2033331233
##########
gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/GatewayServerClasspathExtender.java:
##########
@@ -99,4 +100,19 @@ private boolean startsWithDelimiter(String path) {
return Arrays.stream(CLASS_PATH_DELIMITERS).anyMatch(path::startsWith);
}
+ private Path getGatewayConfDir() {
+ String configDir = getVar(KNOX_GATEWAY_CONF_DIR_VAR, base.getPath() +
CONFIG_PATH);
+ return Paths.get(configDir, CONFIG_FILE);
+ }
+
+ private String getVar(String variableName, String defaultValue) {
+ String value = System.getProperty(variableName);
+ if (value == null) {
+ value = System.getenv(variableName);
+ }
+ if (value == null) {
+ value = defaultValue;
+ }
+ return value;
Review Comment:
nit:
```
return Optional.ofNullable(System.getProperty(variableName))
.or(() -> Optional.ofNullable(System.getenv(variableName)))
.orElse(defaultValue);
```
This might be more concise, but your code works too.
Issue Time Tracking
-------------------
Worklog Id: (was: 965236)
Time Spent: 20m (was: 10m)
> Option to read the gateway config from sys property during classpath extension
> ------------------------------------------------------------------------------
>
> Key: KNOX-3122
> URL: https://issues.apache.org/jira/browse/KNOX-3122
> Project: Apache Knox
> Issue Type: Improvement
> Components: Server
> Affects Versions: 2.2.0
> Reporter: Tamás Hanicz
> Assignee: Tamás Hanicz
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> This change is an improvement on KNOX-3108 (classpath extension). The gateway
> config file's location should be read from a system property first during
> classpath extension. The solution should be similar to the one we already
> have when we look for the config file on GatewayConfigImpl class.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)