Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service configuration using environment variables #229

Open
gskorupa opened this issue Oct 11, 2020 · 0 comments
Open

service configuration using environment variables #229

gskorupa opened this issue Oct 11, 2020 · 0 comments

Comments

@gskorupa
Copy link
Owner

gskorupa commented Oct 11, 2020

If the value of a service parameter starts with the sign "$" then that value will be taken from the environment variable.

For example servicetitle parameter value will be taken from STITLE environment variable:

{
    "@type": "org.cricketmsf.config.ConfigSet",
    "services": [
        {
            "@type": "org.cricketmsf.config.Configuration",
            "id": "MyService",
            "service": "com.my.Service",
            "properties": {
                "servicetitle": "$STITLE",
                ...
            },
            "ports": [
             .... 
           ]
     }
}

In case of configuration of adapters, support for this mechanism can be implemented in the adapter's loadProperties method:
E.g.:

public void loadProperties(HashMap<String, String> properties, String adapterName) {
        super.loadProperties(properties, adapterName);
        token = properties.getOrDefault("token", "");
        if (token.startsWith("$")) {
            token = System.getenv(token.substring(1));
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant