companion icon indicating copy to clipboard operation
companion copied to clipboard

Add machine hostname as a new variable

Open peternewman opened this issue 1 year ago • 2 comments

Is this a feature relevant to companion itself, and not a module?

  • [X] I believe this to be a feature for companion, not a module

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the feature

Maybe up to three variables, representing hostname, domain and FQDN which you can use wherever required.

Usecases

E.g. in API calls via the HTTP generic module you may wish to identify the machine making the calls.

peternewman avatar Jun 06 '24 23:06 peternewman

I don't know how easy it will be to figure out some of these values, especially figuring out how to make them consistent across each os. But if they can all be generated on each platform then having them would be reasonable

Julusian avatar Jun 08 '24 16:06 Julusian

Yeah that makes sense @Julusian .

I've opened #2916 to get in the easy one of hostname which already exists (and would resolve my specific use case), I just added the others to be a bit more feature complete really, I've not dug around to find out which if any npm packages may solve those specific challenges in a cross-platform way.

peternewman avatar Jun 14 '24 23:06 peternewman

To build on this (I know in Linux we can also set and change any global environment variable) if there is a way to just monitor one or more global variables which we specify by name in Companion, then it can be used more broadly too e.g. I could have a variable set for CURRENTAPP and it that becomes say MSWORD then trigger a change page etc. But those variables could also be hostname.

Danie10 avatar Jul 07 '24 21:07 Danie10

In beta there is now $(internal:hostname) and $(internal:hostname_fqdn). For the fqdn, it is using https://systeminformation.io/os.html which uses some platform specific strategies for determining https://github.com/sebhildebrandt/systeminformation/blob/bb006e4ae2ffc21558e7d31622a673e3b12a38f0/lib/osinfo.js#L167-L201

Julusian avatar Jul 21 '24 21:07 Julusian