Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard: Support hostname placeholder for external services #272

Closed
ThomDietrich opened this issue Jan 3, 2018 · 8 comments
Closed

Dashboard: Support hostname placeholder for external services #272

ThomDietrich opened this issue Jan 3, 2018 · 8 comments

Comments

@ThomDietrich
Copy link
Member

ThomDietrich commented Jan 3, 2018

@paulianttila this is a request related to #185

I've successfully integrated dashboard tile creation for additional components in openHABian (PR). One issue openHABian users are now facing is, that the URL in dashboard.cfg as created by openHABian includes the hostname of the system. This most of the time will work for the end user. Sadly some users already reported issues after changing the hostname, others might access their system via an external domain name.

In order to solve this issue it would be one solution to allow placeholder in the configuration file.

Example:

# dashboard.cfg
frontail.link-url=http://$HOSTNAME:9001

A dashboard at http://my-custom-hostname:8080/start/index would redirect to http://my-custom-hostname:9001

Did I miss something? Do you think the idea goes into the right direction?

Best! Thomas

@paulianttila
Copy link
Contributor

@ThomDietrich, so you ideas is that dashboard bundle should resolve the host name on runtime and replace $HOSTNAME by resolved host name? If yes, that should be doable :)

@ThomDietrich
Copy link
Member Author

Yes. The hostname of the device OR the host/domain the dashboard is presented on (e.g. https://home.domain.com/start/index).
Any solution that would solve the issue at least in the local network would be great! Thanks!

@paulianttila
Copy link
Contributor

@ThomDietrich , what do you think about following:

$HOSTADDRESS will be replaced by the IP address (InetAddress.getLocalHost().getHostAddress()).
$HOSTNAME will be replaced by the host name (InetAddress.getLocalHost().getHostName()).
$DOMAINNAME will be replaced by the fully qualified domain name (InetAddress.getLocalHost().getCanonicalHostName()).

E.g. getCanonicalHostName is not guaranteed to work, so what should be done if it fails? Should we always try to fallback e.g. to IP address? What if server have multiple network interfaces?

@ThomDietrich
Copy link
Member Author

ThomDietrich commented Jan 4, 2018

Good to know you can access all of these easily.
I'm also unsure... If you provide all three of those, I can play around with them a bit.
I'd say the fallback from a domain should be the hostname. It should be reachable in a normal home subnet.

While you are at and if they are easily accessible, could you also provide placeholders for the protocol (http/https) and the port (8080)? Who knows when they might become interesting...

@paulianttila
Copy link
Contributor

What do you mean by placeholder for protocol and port? Dashboard bundle can't know which protocol external service support (http or https), or which tcp port the external service is listening. Or did I totally misunderstand what your wrote?

@ThomDietrich
Copy link
Member Author

No you understood me just right. The dashboard is served by OH/ESH itself, I am not aware how much data you are able to retrieve regarding the connection of an end user.
Anyhow, as I said I am not sure what I'D use them for so don't bother to look into it further. The hostname/fqdn are what is really interesting!

@paulianttila
Copy link
Contributor

I am not aware how much data you are able to retrieve regarding the connection of an end user.

None. Implementation what I planning to do is just to replace those magic words during dashboard initialization (when tiles are added to dashboard) or when configuration file is reloaded.

@paulianttila
Copy link
Contributor

@ThomDietrich, see #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants