Community:NDR/Releases/1.3/CONFIGURE
From NSDLWiki
The NDR repository is configured by a series of key/value pairs, which may be built in, defined as system properties, or specified in properties files. There is a fixed order of preference for determining the configured values:
- System properties
- Properties specified in external properties files
- Default built-in values
In other words, System properties always override values specified in external configuration files and the built-in defaults. Externally-defined properties override the defaults, and if nothing else is available, the NDR will use the built-in defaults.
All configuration properties (and their default values) may be found in the source distribution for the ndr, in src/config/properties/defaults
. This directory contains several properties files representing different modules in the NDR.
Contents[hide] |
Enabling Custom Configurations
There are several ways of enabling custom configuration properties in the NDR repository. They are:
- On an ad-hoc basis, defining a system property on tomcat startup for the desired property/value pair. This is useful on an ad-hoc basis especially for experimenting and testing. For example, if one wished to have the repository log into Fedora using a different user name, one would start up Tomcat with the parameter
-Dparam.usr.fedora=myFedoraUser
. - Use the system property
-Drepository.config=/path/to/config/files
to specify the location of external properties files to load. If this path is a directory, all properties files in that directory will be used. - Specify a context parameter in Tomcat specifying the location of the external configuration files. An example is given in
src/config/repository.xml
. The contents of that file may be modified and copied to$TOMCAT/conf/Catalina/localhost/repository.xml
OR added to$TOMCAT/config/server.xml
. The disadvantage of the former is that Tomcat may delete that file if you were to un-deploy the repository webapp, or replace the war with a newer version.
Configuration Property Files
The easiest way to custom-configure the NDR repository is to copy the desired configuration files to a dedicated NDR configuration directory, specify that directory to the NDR as the configuration directory, and edit any properties that are needed. Anything not specified in these configuration files will fall back to their default value, so there is no need to copy every file over, but no harm in doing so either.
authorization.properties
Contains properties that pertain to the authorization module. Most relevant are param.repository.api.auth.canonicalBasePath
and param.repository.api.auth.alternatePath.*
.
The authorization module needs to know what valid repository URLs look like in order to perform the authorization. These values are used to specify the path after the hostname. For example: http://my.server/repository/api
uses a path of /repository/api
. That's the default canonical base path, so there's no need to change anything. If you used Apache to proxy or re-write the URL to something like: http://my.server/ndr
, then you'll need to either specify /ndr
as the canonical base path, or add it to the list of possible alternate acceptible paths, as in param.repository.api.auth.alternatePath.production = /ndr