Skip to content

Issues with using YACY_ environment variables for camelCase settings #794

@mmeier86

Description

@mmeier86

Hello YaCy team,

I've been setting up my new instance using the YACY_ environment variables, and I've found that while it works for some settings like port or upnp.enabled, it does not work for others, like staticIP or browserPopUpTrigger. The environment variables for the latter to just be ignored, and my yacy.init still contains browserPopUpTrigger=true, and my startup logs still show the log lines where it tries to launch the browser.

Digging through the code, I think I might have found the problematic place:

for (final Map.Entry<String, String> entry: System.getenv().entrySet()) {
final String yacykey = entry.getKey();
if (yacykey.startsWith("YACY_")) {
key = yacykey.substring(5).toLowerCase().replace('_', '.');
if (this.configProps.containsKey(key)) this.configProps.put(key, entry.getValue());
}
}

I think the problem here is the toLowerCase here in line 146. Take for example the YACY_BROWSERPOPUPTRIGGER variable. The key value would end up as browserpopuptrigger, and I assume that the configProps.containsKey method does a case sensitive comparison and thus won't find the key, leading to the environment variable not being used.

For this one I'm afraid I wasn't able to come up with a good solution I could propose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions