MantisBT - opensim
View Issue Details
0008560opensim[REGION] OpenSim Corepublic2019-07-11 04:452021-10-19 19:42
Standalone (1 Region)
Mono / Linux64
0008560: Include directives do not take environment variables expansion
Doing some overlaying configuration scheme, I discovered the Opensim configuration system does not use environment variable expansion to resolve included files (which is really handy to make a generic configuration scheme, for example putting in a folder with Opensim instance name a local ini file to overwrite global settings).

Checking the code, I found in Opensim/Region/Application/ConfigurationLoader.cs, line 239, that :
    string file = config.GetString(k);
could be replaced by :
    string file = config.GetExpanded(k);

Method referenced at [^]

I could not test myself as I never compiled Opensim and have not the correct environment to do so (in my todo list)
In main Opensim, Add an [Environment] section
In this section, reference an environment variable
Add a new Include directive to use that environment variable to resolve the path of the included file.

  CONFDIR = ""

  Include-Local = "${Environment|CONFDIR}/Local.ini
No tags attached.
Issue History
2019-07-11 04:45TyphaineArtezNew Issue
2019-07-11 06:57TyphaineArtezNote Added: 0035468
2019-07-11 06:57TyphaineArtezNote Edited: 0035468bug_revision_view_page.php?bugnote_id=35468#r8288
2019-07-31 07:30UbitUmarovNote Added: 0035522
2019-07-31 18:43tampaNote Added: 0035532
2021-10-19 19:42tampaStatusnew => acknowledged

2019-07-11 06:57   
It seems the way environment variables are expanded (after reading the whole config files) does not match the solution given in my initial post.

I tried to compile and apply the fix, and the reference to the environment variable is expanded to the empty string.

I don't know enough how all this works to make a more complex fix.

2019-07-31 07:30   
Thanks for the try and sharing anyways
I may look to this sometime in future
2019-07-31 18:43   
You can override variables if you make sure they are loaded last. For this define a custom file that isn't an ini and place your variable in startup section. I tried this along with setting dynamic, at runtime, variables, unfortunately that part would not work, but what you try to do there should work this way.