-
Notifications
You must be signed in to change notification settings - Fork 783
Environment variables in configuration files #4537
Comments
Currently it is not supported to insert environment variables into those .cfg files. The (ConfigDispatcher)[https://github.com/eclipse/smarthome/blob/master/bundles/config/org.eclipse.smarthome.config.dispatch/src/main/java/org/eclipse/smarthome/config/dispatch/internal/ConfigDispatcher.java] is responsible for parsing these files. Before you create a PR: May I ask what you are trying to achieve by inserting the HOSTNAME environment variable into the config file? I.e. what is your specific use case that you are trying to cover? |
I have posted my specific use case in the openHAB community chat forum. https://community.openhab.org/t/additional-parameter-in-mqtt-persistence/36039 |
From the posted link I read that you are trying to send MQTT messages that have the HOSTNAME in their topic from openHAB/ESH to a MQTT broker, right? So I am wondering if configuration files are the right place to touch here. You somehow need access to the hostname where openHAB/ESH is running on. So where do you create your messages with your custom topic? Within rules? Then maybe you need to have a way to retrieve the HOSTNAME from within a rule in the ruleengine? |
@triller-telekom You can define the custom mqtt topic to publish to via the mqtt.persist file: http://docs.openhab.org/addons/persistence/mqtt/readme.html Apart from this use-case: I'm thinking about system hostname for callbacks (is there (apart from java code) any other chance in ESH / OH2 to retrieve the system hostname?), locales and time zones, pwd. |
That's why I want to know where he needs access to the hostname. Because things such as |
Hi,
it is possible to use linux environment variables in the configuration files?
The backround is, that I want to use the "HOSTNAME" in the configuration files.
Update:
In the configuration files I mean in detail the *.cfg files in services.
If that does not work, where would I have to insert this as an enhancement in the code (Unix/Windows).
Would this be accepted as a pull request?
The text was updated successfully, but these errors were encountered: