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

Allow sysadmin to override grails.config.locations using command line argument or env property #22

Closed
ghost opened this issue Dec 26, 2013 · 4 comments
Assignees
Labels
type: maintenance Code improvements, optimizations and refactors, dependency upgrades...
Milestone

Comments

@ghost
Copy link

ghost commented Dec 26, 2013

Outline:

It might not always be possible to setup a directory .grails in the Tomcat home in order to configure open-boxes due to operational restrictions. Given the fact that the data source specification and others reside in this properties file, without it the application (don't think) can connect to the underlying db.

Solutions:

Hard coding a default solutions is not a good idea (in case the code can not find the properties).
Instead, and given the nature of a previous defect regarding properties files, this property fils should be amalgamated with the one in the application.properties file.
This way, deployment would become more streamlined.

@ghost
Copy link
Author

ghost commented Dec 26, 2013

Addendum:

Looks like the application.properties is a grails specific meta data file.
Therefore perhaps not the place to put the db connection details as mentioned above.
Q1. Still not clear if the openboxes-config.properties file is the ONLY place dataSource.* are specified?
Ans: this is set in the config.groovy file of the grails-app/conf folder and it is here that either a config.groovy or an openboxes-config.properties file are set as possible configuration files.

At least the configuration location should be parameterizeable for the above files, and preferably in line with standard deployment of .war or .ear files.

Looks like for this older version of grails the ServletContext is not accessible from config.groovy in order to say access a property file in WEB-INF/ or WEB-INF/classes.
I would suggest then to place the config in the webapps directory of the application server which is operationally read/writeable.

@jmiranda
Copy link
Member

jmiranda commented Jan 7, 2014

I'm not opposed to adding more locations to grails.config.locations. In fact, there are two locations that I commented out that would probably resolve this issue for you. I'll just uncomment these. Let me know if you want others.

grails.config.locations = [ 
    //"classpath:${appName}-config.groovy",
    //"classpath:${appName}-config.properties",
    "file:${userHome}/.grails/${appName}-config.groovy",
    "file:${userHome}/.grails/${appName}-config.properties"
]

@ghost
Copy link
Author

ghost commented Jan 7, 2014

Okay, so what I experimented with, was to set an environment variable that then drove the location for the properties file.
It worked pretty well, and would allow for the flexibility of the prefix to the file to be dynamically not dependent on userHome.
I don't know how this would sit with you, but I can share the code...its is really trivial :=)

@jmiranda jmiranda changed the title openboxes-config.properties should be moved into the application.properties file Allow sysadmin to override grails.config.locations using command line argument or env property Dec 8, 2016
@jmiranda jmiranda reopened this Dec 8, 2016
@jmiranda
Copy link
Member

jmiranda commented Dec 8, 2016

I just realized that the commit above accidentally caused this ticket to close. However, we really want to be able to set these config locations from the command-line or system env property.

jmiranda added a commit that referenced this issue Dec 8, 2016
@jmiranda jmiranda added this to the 0.7.14 milestone Dec 8, 2016
@jmiranda jmiranda added the type: maintenance Code improvements, optimizations and refactors, dependency upgrades... label Dec 8, 2016
@jmiranda jmiranda self-assigned this Dec 8, 2016
jmiranda added a commit that referenced this issue Dec 8, 2016
#22 allow sysadmin to add custom config location using command line or environment variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: maintenance Code improvements, optimizations and refactors, dependency upgrades...
Projects
None yet
Development

No branches or pull requests

1 participant