I have a properties file that looks like this
server.se.host
server.se.port
server.us.host
server.us.port
and so on. It's a list of host/port used for different countries (Sweden and US in this example). These can also be set as environment variables in the form SERVER_SE_HOST and so on.
The code however, doesn't know what countries exists at build time so I need to dynamically find these variables, including the ones only available as environment variables at run time.
Ideally I'd like to get configration class with a dynamic prefix, something like
Config countrySpecificConfig = ConfigMagic.getFromPropertiesWithPrefix("server." + countryCode);
If that is not possible I would be happy with
String countrySpecificHost = PropertiesMagic.get("server." + countryCode + ".host");
String countrySpecificPort = PropertiesMagic.get("server." + countryCode + ".port");
but I haven't found a way to do that either.
Thanks.