Archived

This forum has been archived. Please start a new discussion on GitHub.

Variables in config Files

Hello,

I have the following configuration file what I use multiple times in my application:
TopicManager.Proxy=TestIceStorm/TopicManager:default -p 40001 -h 192.168.2.2
OSLInterface.Proxy=TestInterface/Query:default -p 40003

CalculatorAdapter.AdapterId = CalculatorAdapter
CalculatorAdapter.Endpoints = tcp -h 192.168.2.2 -p 10000
Identity = Calculator

Ice.Default.Locator = IceGrid/Locator:tcp -h 127.0.0.1 -p 4061
Ice.MessageSizeMax = 32768

I'd like to know if it's possible to change the ip address '192.168.2.2' by a variable, for example 'TestIP' so that I only have to change this IP once. My config file should look like this then:
TestIP = 192.168.2.2
TopicManager.Proxy=TestIceStorm/TopicManager:default -p 40001 -h TestIP
OSLInterface.Proxy=TestInterface/Query:default -p 40003

CalculatorAdapter.AdapterId = CalculatorAdapter
CalculatorAdapter.Endpoints = tcp -h TestIP -p 10000
Identity = Calculator

Ice.Default.Locator = IceGrid/Locator:tcp -h 127.0.0.1 -p 4061
Ice.MessageSizeMax = 32768

Kind regards

Comments

  • bernard
    bernard Jupiter, FL
    Hi Jens,

    There is no such thing as a "variable" with Ice configuration files. There are however other options you may want to consider:

    - since you're using IceGrid, and this is the configuration for a server, you should write a 'server descriptor' and let IceGrid generate this configuration file for you. You can use variable with IceGrid descriptors, e.g. here it may want to use a 'server template' with a TestIP parameter.

    - you can use DNS names instead of IP addresses in stringified proxies and endpoints. Probably not a great option here as you may not want "TestIP" to resolve to different IPs on different hosts.

    Best regards,
    Bernard
  • Hello

    Thanks for the help, I'm gonna try to change the xml file so I can add all the properties in it. That should make my program a bit more simple.

    Kind regards