Archived

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

Using environment variables with config.txt

Hi!

Running a particular Ice application on multiple hosts, we came across the question whether it is possible to include environment variables or such in Ice's configuration file, like:

IceBox.ServiceManager.Endpoints=tcp -h %MYHOST% -p 9995

If not, do you have a suggestion on how to flexibly set up config files for different environments?

Best regards,

Stephan

Comments

  • No, the config file parser doesn't look at environment variables. Changing this wouldn't be all that easy, in particular for Java 1.4, which can't get at the environment at all.

    I can see two options for you to do what you want:

    - Use IceGrid deployment descriptors, which allow you to substitute certain variables (but not arbitrary user-defined variables). This may be just enough for what you need.

    - Use a preprocessor such as Perl or sed to substitute the values into the config file.

    Cheers,

    Michi.