[
https://issues.apache.org/jira/browse/CONFIGURATION-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vasily Ivanov updated CONFIGURATION-284:
----------------------------------------
Attachment: EnvironmentConfiguration.java
I have create simple Configuration to read environment variables. Please see
file attached.
Also, I have tried to use
PropertiesConfiguration.PropertiesReader#parseProperty(String line) magic, but
it returns corrupted Windows paths by unescapeing variables values when it is
not necessary. I didn't find a way to prevent it doing that. However, here is
the code for you convenience if you want to play around:
private static Properties readEnvVariables(final InputStream in) throws
IOException
{
Properties props = new Properties();
PropertiesConfiguration.PropertiesReader reader =
new PropertiesConfiguration.PropertiesReader(new InputStreamReader(in));
while (reader.nextProperty()) {
props.setProperty(reader.getPropertyName(), reader.getPropertyValue());
}
return props;
}
Note: I haven't tested it in UNIX, but it should work just fine.
> ability to read OS environment variables
> ----------------------------------------
>
> Key: CONFIGURATION-284
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-284
> Project: Commons Configuration
> Issue Type: New Feature
> Components: Interpolation
> Reporter: Aksel Schmidt
> Priority: Minor
> Attachments: EnvironmentConfiguration.java
>
>
> suggestion:
> interpolation with system environment, i.e.
> ${sys:user.name} reads from systemproperties (as of today)
> ${sysenv:TEMP} reads from OS environment
> these can be parsed from a supported set of OS's - windows read from a set in
> a "cmd /c", unix/linux from an "env" etc. (just once on demand)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]