...
Change your
config-definition.xml
to use a system property (of your choice) instead of the hardcoded name "local.cfg". The Configuration Definition file itself does allow for variables to be included, but they must be specified in a previous configuration source (in that config-definition.xml) or via a system property. See the Configuration File Documentation for more details. So, you could simply change your config-definition.xml to use a "dspace.env
" system property, and pass "-Ddspace.env=dev
" to have it use a[dspace.dir]/config/dev.cfg
:Code Block <!-- Change local.cfg to be ${dspace.env} in your config-definition.xml --> <properties fileName="${dspace.env}.cfg" throwExceptionOnMissing="false" config-name="local" config-optional="true"> ... </properties> <!-- OPTIONALLY: If you wanted to have some default local configs shared among *all* environments, you could add a NEW "properties" file to always load those defaults. In this example, default.cfg would be loaded for ALL environments. Configs in the environment-specific ${dspace.env}.cfg would override default.cfg, and both would override dspace.cfg (and other *.cfg). --> <properties fileName="default.cfg" throwExceptionOnMissing="false" config-name="default" config-optional="true"> ... </properties>
Alternatively, you could use the "
include=
" option (of Apache Commons Configuration Properties Files) within yourlocal.cfg
file to load a different configuration file, again based on a setting specified as a system property. For example, yourlocal.cfg
file would ONLY consist of a single "include=
" statement(s), which would load whichever configuration file was specified as the "dspace.env" system property:Code Block # This is the ENTIRE local.cfg (all settings would instead be located in environment-specific config files) # Its job is just to load up the configuration for the environment specified by "dspace.env" # For example, -Ddspace.env=dev would load [dspace.dir]/config/dev.cfg # and -Ddspace.env=prod would load [dspace.dir]/config/prod.cfg # Load the environment-specific file include = ${dspace.env}.cfg # OPTIONALLY: If you wanted to have some default local configs shared among *all* environments, you could add # a second "include=" statement to always load those defaults from a file of your choice. In this example, # a default.cfg would be loaded for ALL environments. Configs in the environment-specific ${dspace.env}.cfg # would override default.cfg, and both would override dspace.cfg (and other *.cfg). include = default.cfg
...