Making a dynamic tag that will show the user in which gateway environment they are

Hello,

I would like to ask that I am trying to make the dynamic tag which will show a text that in which gateway environment they are (developer, testing, staging, etc)

Here are some information

1, There are 3 gateway present on the server machine (Developer, Testing, and Staging)
2, The task is to show on the label on the top of the header bar that in which environment they are working.
3, The label which will show the name of the gateway is binded to a tag (a dynamic tag) which will show that in which gateway user is currently working.

Is it possible to show this functionality using expression tag or something else?

Hope to hear soon.

Thanks

I would definitely say you should have your gateways on different servers or at least different VM’s as it would make the this way feasible:

You could differentiate by IP address but since currently all your gateways are on the same machine that won’t do. Separating them would make this an option and then you can do some expression tag with a case statement to determine what environment you are in based on the ip address. If a ip address of any of them change you would need to change the expression in all 3.

Alternatively, you can make a memory tag maybe called Environment and in each separate gateway have it say what you want. Nothing else should ever write to this tag. The risk here is another designer not knowing what the tag does and putting in some other text.

Lastly, you could set up a simple json file that may look something like like

{
    "environment":"staging"
}

that’s in the same relative position of the install directory of each Gateway and in your Gateway Startup event script, read that json file, and then write it to a gateway memory tag. This method would work even if IP addresses are changed and if someone overwrites it, next gateway restart it gets reset.

Last method requires the most scripting but is the most robust. But if you are the only designer a simple memory tag that has the same tag path across each gateway that you manually edit will also do the job just as well.

1 Like

Could you just read the [System]Gateway/SystemName tag? Or are the different gateway names not unique?

3 Likes

Thank you for your response. Yeah your solution will require lots of scripting which I am trying to avoid but it will be useful in my future development.

Good idea. I will try to use this one as gateway names are unique.

1 Like

It is for the json but the bonus is you can set up other configurations in there if you ever need them. If you don’t though it is a bit overkill.