Skip to content

Commit 7b5c262

Browse files
Merge pull request #247 from pneuschwander/patch-1
Update BaSyxMqttConfiguration.java - Accept clientId via env-vars
2 parents 1ef1760 + a7e4bf4 commit 7b5c262

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

basyx.components/basyx.components.lib/src/main/java/org/eclipse/basyx/components/configuration/BaSyxMqttConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class BaSyxMqttConfiguration extends BaSyxConfiguration {
4747
public static final String DEFAULT_QOS = "1";
4848
public static final String DEFAULT_PERSISTENCE_TYPE = MqttPersistence.FILE.toString();
4949
public static final String DEFAULT_PERSISTENCE_PATH = "";
50+
public static final String DEFAULT_CLIENT_ID = "default-client-id";
5051

5152
public static final String USER = "user";
5253
public static final String PASS = "pass";
@@ -72,7 +73,7 @@ public static Map<String, String> getDefaultProperties() {
7273
defaultProps.put(QOS, DEFAULT_QOS);
7374
defaultProps.put(PERSISTENCE_TYPE, DEFAULT_PERSISTENCE_TYPE);
7475
defaultProps.put(PERSISTENCE_PATH, DEFAULT_PERSISTENCE_PATH);
75-
defaultProps.put(CLIENT_ID, CLIENT_ID);
76+
defaultProps.put(CLIENT_ID, DEFAULT_CLIENT_ID);
7677
return defaultProps;
7778
}
7879

@@ -114,7 +115,7 @@ public BaSyxMqttConfiguration(String user, String pass, String server, int qos)
114115
* Load all settings except of the whitelist config part
115116
*/
116117
public void loadFromEnvironmentVariables() {
117-
String[] properties = { USER, PASS, SERVER, QOS };
118+
String[] properties = { USER, PASS, SERVER, QOS, CLIENT_ID };
118119
loadFromEnvironmentVariables(ENV_PREFIX, properties);
119120
}
120121

0 commit comments

Comments
 (0)