Interface to CouchDB that allows the control of permissions on the documents.
The configuration is being read on load from many sources, in the following order (ascending priority):
- Default configuration. Some configuration elements have default values. They are defined in the source code
- Main configuration file (
config.js
orconfig.json
in ROC's home directory) - Database configuration file (
config.js
in database's subdirectory) - Environment variable (uppercase snake-case with
REST_ON_COUCH_
prefix) - Custom config file passed with
--config
in the CLI
Type: string
Default: 'http://localhost:5984'
URL of the CouchDB server.
Type: string
Default: undefined
Username for CouchDB connection.
Type: string
Default: undefined
Password for CouchDB connection.
Type: string
Default: 'WARN'
Level of the logs stored in the database. Possible values are FATAL (1), ERROR (2), WARN (3), INFO (4), DEBUG (5) and TRACE (6).
Logs are only inserted if the current level is equal or higher to the log's level.
Type: number
Default: 570
Time in seconds that the application waits before revalidating the session with CouchDB.
This number should be smaller than the session's cookie life.
Type: number
Default: 3000
Port used by the rest-on-couch server.
Type: object
Default: {couchdb:{}}
Object describing the authentication strategies that are available and providing options to them.
Type: boolean
Default: true
Set to true
if your application is behind a proxy and needs to trust X-Forwarded-
headers.
Type: string
Default: '/'
If the proxy is not at the root level of the URL, set this value to the corresponding prefix.
Type: array<string>
Default: []
If cross-origin calls need to be done, set the list of trusted origins here.
Type: string
Default: undefined
Domain of the session cookie.
Type: string
Default: 'roc:sess'
Key of the session cookie.
Type: string
Default: '/'
Path of the session cookie.
Type: boolean
Default: false
Set to true
if the cookie should only be valid on secure URLs.
Type: string
Default: 'lax'
Value of the "SameSite" cookie option. Set to 'strict'
, 'lax'
, or 'none'
.
Type: boolean
Default: false
If set to true
, a stack trace will be print to the body of the response when an error occurs.
Do not use this in production!
Type: boolean
Default: false
If set to true
, enables the Zenodo API.
Type: string
Name of this application/database. This will be used in the keywords for each
entry that is created. For example, if zenodoName
is 'db123'
, entries will
contain the keyword 'from:db123'
.
This option is mandatory if zenodo
is true
.
Type: string
API token for Zenodo.
This option is mandatory if zenodo
is true
.
Type: string
API token for Zenodo's sandbox.
Type: string
URL prefix for entry visualization. If set, the Zenodo entry ID will be appended
to this, optionally with a ?sandbox=1
query string. A link will be added at the
end of the entry's description.
Type: string
Default contents of the _README.md
that is published in the Zenodo entry.
Type: function
Function that is called with each ROC entry's contents and must return a list of
attachments to add to the Zenodo entry. It can also return an object if a single
attachment is to be added
function zenodoAttachments(content) {
if (content.general && content.general.molfile) {
return {
filename: 'molfile.mol',
contentType: 'chemical/x-mdl-molfile',
data: content.general.molfile,
};
} else {
return [];
}
}
docker-compose up -d
Go to http://localhost:5984/\_utils/#setup
- Single node
- username: admin, password: admin
- bind address: 0.0.0.0
- Execute the bash script
/setupDatabase.sh
- Execute the tests:
npm t
rest-on-couch
is able to watch folders and to automatically import data in the database.
A specific userguide is available here.