Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Problem with configuration and environment variables after updating to grails 3.3.3 #130

Closed
jjballano opened this issue Mar 29, 2018 · 5 comments · Fixed by #133
Closed

Comments

@jjballano
Copy link

Hi,
I've updated to Grails 3.3.3 recently and started getting problems with this plugin.
According to grails/grails-core@65f7bc6, Grails now gives more priority to environment variables than application.yml configuration. That's a good thing I guess.
The problem I have with this plugin right now is that it doesn't use the prefix rabbitmq.connections with username, password, etc params (https://github.com/budjb/grails-rabbitmq-native/blob/grails-3.x/rabbitmq-native/src/main/groovy/com/budjb/rabbitmq/connection/ConnectionConfigurationImpl.groovy#L126) and I need a username environment variable (with different value) in my server. So username environment variable is overriding the username rabbitmq configution.

I think the best approach to avoid this is using rabbitmq.connections.username instead of just username, so no conflicts will happen again

@kszymko
Copy link

kszymko commented Apr 11, 2018

Hi,
I had to downgrade Grails to 3.3.2 because of this issue. Environment variable username is overriding rabbitmq configuration from application.yml in Grails 3.3.3 and 3.3.4.

NavigableMapConfig.groovy from grails-core:

    @Override
    public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
        Object value = findInSystemEnvironment(key);
        if (value == null) {
            value = configMap.get(key);
        }

        return convertValueIfNecessary(value, targetType, defaultValue);
    }

Please fix this issue so the values provided in application.yml are NOT overridden by the env variables.

@raptordzuricsko
Copy link

Also having this issue

@jaGarcia
Copy link

jaGarcia commented May 1, 2018

Encountered same issue with "port" config colliding with environment variable set by Heroku, preventing deployment of grails applications greater than 3.3.2

@gevorg
Copy link
Contributor

gevorg commented Jul 8, 2018

Were you able to find any workarounds other than downgrading grails to 3.3.2 ?

@gevorg
Copy link
Contributor

gevorg commented Jul 8, 2018

Hi @budjb , could you please review my PR, it adds internal prefix rabbitmq to all configs to avoid conflicts with environment variables. Note that all external configurations will work as before, nothing need to be changed. If you will be able to publish this change, that would be really great as I will be able to use this plugin with Grails 3.3.6.

Thanks for this plugin and thanks for reviewing my PR. Gevorg

budjb added a commit that referenced this issue Jul 9, 2018
[#130]: Added rabbitmq prefix, to avoid conflicts with environment variables.
@budjb budjb closed this as completed in #133 Jul 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants