Home Help Center

Using environment variables with config.txt

stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG

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,



  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    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.


Sign In or Register to comment.