...
Info |
---|
In a patch to Grouper 2.4, Grouper will allowand in Grouper 2.5+, Grouper allows configuration to be stored in the database rather than in configuration files. See |
Some Grouper configuration files can have overlays so that only the changes from the defaults of the config files need to be tracked in the institution specific config file. Also, configs can be centrally stored on a server across multiple webapps or standalone Grouper applications. There can be a default configuration file, and an override file so that only the changes from the default can be tracked in the overlay.
...
- grouper.properties
- grouper.hibernate.properties
- grouper-loader.properties
- grouper-ui.properties
- grouper-ws.properties
- grouper.client.properties
- subject.properties
- grouper.cache.properties (2.3.0.patch+)
- grouper.text.en.us.properties
In the future we can add this feature to other config files as well.
Java code to read configs from config files (e.g. for GSH templates or scripts)
Expand | ||
---|---|---|
| ||
|
Escape chars
You can escape chars, when they are read by the property config framework, they will be unescaped
Unicode | Value |
---|---|
U+0024 | $ |
U+0020 | space |
U+007B | { |
U+007D | } |
U+000A | newline \n |
U+002B | + |
How it works
Each of the properties files has a base file, and a config file. For example, there is a grouper.base.properties, and a grouper.properties. Both of these are located on the classpath in the default package. e.g. WEB-INF/classes/grouper.base.properties and WEB-INF/classes/grouper.properties. Generally all the default settings will be located in the base file, and only the things that are overridden are in the grouper.properties. This is a change in Grouper v2.2+ since before that all properties are in the grouper.properties file, and the example file was used just to show what configs are possible.
...
You can specify the property key in such a way that you can have value include expression language scriplets. The class educlass edu.internet2.middleware.grouperClient.util.GcElUtilsSafe can be referenced as "elUtils". To specify a key as EL, append this suffix to the config key: .elConfig
...
This will result in the value (for key: some.config.2): start middle something else
Another example, look in another non-grouper properties file
Code Block |
---|
hibernate.connection.url.elConfig = ${ edu.internet2.middleware.grouper.util.GrouperUtil.propertiesFromFile(new("java.io.File","/Users/mchyzer/git/grouper_v2_5/grouper/conf/myfile.properties"), false).getProperty("myurl") } |
Environment variables
If you want a grouper properties config file to be pulled from an environment variable, do this:
...
have an env var, you can have any property be an env var... just configure it in a config file as (for property a.b.c):
|
...
|
That will cause the property "somethingWhatever" to have the value "c:\dev_inst\java" or whatever it is set to. Do the following two things:
- append .elConfig to the propertyName
- this is the value: ${java.lang.System.getenv().get(
elUtils.processEnvVarOrFile
('JAVA_HOME')} - note, if the value of the env var is a variable, it will get it from there
Example:
When I have this in grouper.properties:
...