Skip to content

Commit

Permalink
Merge branch 'release-5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Jun 20, 2019
2 parents eb6833f + 9ec0a4b commit 4c92400
Show file tree
Hide file tree
Showing 73 changed files with 5,452 additions and 3,193 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ cache:
- node_modules
notifications:
email: false
slack:
secure: jnmTBfHGzU4rR9RAVsRmwMI3Rdul5PEKioh2oIsWv245DQrqr5DIwEONPRMsCbs1Duk69jiQFAzfLgzjtOjHleac79p0076pSxaG2zXNyzgya5YBMgYv6wrFh9eNZJoXyMvDw8jcipbRbx/Xp05aayClY39BJ7UUFlklvIeFb5wFqRfIlVXbLu5MFFatwCzB1IOeSeD90ZTX9VsWw97SJoJdta5gn7dx0P06SStPSJNOrLmV1/aXrSorBYmeTNJgUWPg4zHanocll8b7TR1a8Iyc5JBip0tEUpf1vJOMb/7bMdmNJ1XL8rzWw/87JujuzdOKikrsi52fzHE70TgsEBf0+BkwtFK2SzRvrwIKVesjj+ek/E2P1gal2qeqDVLVGZYuKAqbigv/0r6MHDcqJLoWb9MGHTLgcobZOfX3+UZetIc8dDA9/yme1auC8efrD4LOdo4Glhf6EZP4xCFUJpZive3VCKQfg/sMBaWAMWY508cxV+ey+fucV8fEqIsZHNPv7mCWoeMc5PnMd5TlR49UDgNrq0xcS8q2n9EKdZZARdsnqwdpmwJ3Ygd3gPsQTdYKsIBUxEoQKhMycO1XaqkbcUSHi8nSw85775cdEUscEob01WRN7D9IX7sGGp3LksFeR1CtjigBtMM9gHwmODUcPmcD+YRPYnnquoGzV9I=
node_js:
- '8.9.4'
- '6.11.1'
- '8'
- '10'
- 'lts/*'
before_script:
- npm prune
branches:
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [5.0.0] (2019-06-20)

### BREAKING CHANGES

The way API clients are internally stored has changed. After upgrading to 5.0.0, existing clients must be migrated. See https://docs.dadi.cloud/api/5.0#migrating-from-version-4-to-5 for more information.

### Added

- [#532](https://github.com/dadi/api/pull/532): add new endpoints for document versioning
- [#533](https://github.com/dadi/api/pull/533): compress responses using gzip
- [#538](https://github.com/dadi/api/pull/538): add global search endpoint and various improvements to search
- [#547](https://github.com/dadi/api/pull/547): add support for ETag and If-None-Match headers

### Changed

- [#534](https://github.com/dadi/api/pull/534): hash client secrets

### Fixed

- [#539](https://github.com/dadi/api/issues/539): "false" filter on Boolean fields
- [#553](https://github.com/dadi/api/pull/553): add default value for index keys
- [#558](https://github.com/dadi/api/pull/558): make Media field output document IDs as String

## [4.4.5] (2019-01-24)

### Fixed
Expand Down
122 changes: 87 additions & 35 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,38 @@ var conf = convict({
},
publicUrl: {
host: {
doc: 'The host of the URL where the API instance can be publicly accessed at',
doc:
'The host of the URL where the API instance can be publicly accessed at',
format: '*',
default: null,
env: 'URL_HOST'
},
port: {
doc: 'The port of the URL where the API instance can be publicly accessed at',
doc:
'The port of the URL where the API instance can be publicly accessed at',
format: '*',
default: null,
env: 'URL_PORT'
},
protocol: {
doc: 'The protocol of the URL where the API instance can be publicly accessed at',
doc:
'The protocol of the URL where the API instance can be publicly accessed at',
format: 'String',
default: 'http',
env: 'URL_PROTOCOL'
}
},
server: {
host: {
doc: 'Accept connections on the specified address. If the host is omitted, the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise.',
doc:
'Accept connections on the specified address. If the host is omitted, the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise.',
format: '*',
default: null,
env: 'HOST'
},
port: {
doc: 'Accept connections on the specified port. A value of zero will assign a random port.',
doc:
'Accept connections on the specified port. A value of zero will assign a random port.',
format: Number,
default: 8081,
env: 'PORT'
Expand Down Expand Up @@ -79,14 +84,16 @@ var conf = convict({
env: 'SSL_INTERMEDIATE_CERTIFICATE_PATH'
},
sslIntermediateCertificatePaths: {
doc: 'The filenames of SSL intermediate certificates, overrides sslIntermediateCertificate (singular)',
doc:
'The filenames of SSL intermediate certificates, overrides sslIntermediateCertificate (singular)',
format: Array,
default: [],
env: 'SSL_INTERMEDIATE_CERTIFICATE_PATHS'
}
},
datastore: {
doc: 'The name of the npm module that implements the data connector used for storing documents',
doc:
'The name of the npm module that implements the data connector used for storing documents',
format: String,
default: '@dadi/api-mongodb'
},
Expand All @@ -107,7 +114,8 @@ var conf = convict({
default: 'YOU-MUST-CHANGE-ME!'
},
accessCollection: {
doc: 'The name of the internal collection used to store aggregate permissions data',
doc:
'The name of the internal collection used to store aggregate permissions data',
format: String,
default: 'accessStore'
},
Expand All @@ -122,7 +130,8 @@ var conf = convict({
default: 'roleStore'
},
datastore: {
doc: 'The name of the npm module that implements the data connector used for authentication',
doc:
'The name of the npm module that implements the data connector used for authentication',
format: String,
default: '@dadi/api-mongodb'
},
Expand All @@ -131,34 +140,52 @@ var conf = convict({
format: String,
default: 'test',
env: 'DB_AUTH_NAME'
},
hashSecrets: {
doc: 'Whether to hash client secrets',
format: Boolean,
default: true
},
saltRounds: {
doc: 'The number of rounds to go through when hashing a password',
format: Number,
default: 10
}
},
search: {
database: {
doc:
'The name of the database to use for storing and querying indexed documents',
format: String,
default: 'search',
env: 'DB_SEARCH_NAME'
},
datastore: {
doc: 'The datastore to use for storing and querying indexed documents',
format: String,
default: ''
},
enabled: {
doc: 'If true, API responds to collection /search endpoints',
format: Boolean,
default: false
},
indexCollection: {
doc:
'The name of the datastore collection that will hold the index of word matches',
format: String,
default: 'searchIndex'
},
minQueryLength: {
doc: 'Minimum search string length',
format: Number,
default: 3
},
wordCollection: {
doc: 'The name of the datastore collection that will hold tokenized words',
format: String,
default: 'words'
},
datastore: {
doc: 'The datastore to use for storing and querying indexed documents',
format: String,
default: '@dadi/api-mongodb'
},
database: {
doc: 'The name of the database to use for storing and querying indexed documents',
doc:
'The name of the datastore collection that will hold tokenized words',
format: String,
default: 'search',
env: 'DB_SEARCH_NAME'
default: 'searchWords'
}
},
caching: {
Expand Down Expand Up @@ -196,7 +223,8 @@ var conf = convict({
},
redis: {
enabled: {
doc: 'If enabled, cache files will be saved to the specified Redis server',
doc:
'If enabled, cache files will be saved to the specified Redis server',
format: Boolean,
default: false,
env: 'REDIS_ENABLED'
Expand Down Expand Up @@ -249,7 +277,8 @@ var conf = convict({
},
accessLog: {
enabled: {
doc: 'If true, HTTP access logging is enabled. The log file name is similar to the setting used for normal logging, with the addition of "access". For example `api.access.log`.',
doc:
'If true, HTTP access logging is enabled. The log file name is similar to the setting used for normal logging, with the addition of "access". For example `api.access.log`.',
format: Boolean,
default: true
},
Expand Down Expand Up @@ -290,14 +319,16 @@ var conf = convict({
default: false
},
routes: {
doc: 'An array of routes to test. Each route object must contain properties `route` and `expectedResponseTime`.',
doc:
'An array of routes to test. Each route object must contain properties `route` and `expectedResponseTime`.',
format: Array,
default: []
}
},
query: {
useVersionFilter: {
doc: 'If true, the API version parameter is extracted from the request URL and passed to the database query',
doc:
'If true, the API version parameter is extracted from the request URL and passed to the database query',
format: Boolean,
default: false
}
Expand All @@ -319,7 +350,8 @@ var conf = convict({
default: 'catboat-beatific-drizzle'
},
tokenExpiresIn: {
doc: 'The duration a signed token is valid for. Expressed in seconds or a string describing a time span (https://github.com/zeit/ms). Eg: 60, "2 days", "10h", "7d"',
doc:
'The duration a signed token is valid for. Expressed in seconds or a string describing a time span (https://github.com/zeit/ms). Eg: 60, "2 days", "10h", "7d"',
format: '*',
default: '1h'
},
Expand All @@ -334,19 +366,22 @@ var conf = convict({
default: 'workspace/media'
},
pathFormat: {
doc: 'Determines the format for the generation of subdirectories to store uploads',
doc:
'Determines the format for the generation of subdirectories to store uploads',
format: ['none', 'date', 'datetime', 'sha1/4', 'sha1/5', 'sha1/8'],
default: 'date'
},
s3: {
accessKey: {
doc: 'The access key used to connect to an S3-compatible storage provider',
doc:
'The access key used to connect to an S3-compatible storage provider',
format: String,
default: '',
env: 'AWS_S3_ACCESS_KEY'
},
secretKey: {
doc: 'The secret key used to connect to an S3-compatible storage provider',
doc:
'The secret key used to connect to an S3-compatible storage provider',
format: String,
default: '',
env: 'AWS_S3_SECRET_KEY'
Expand Down Expand Up @@ -378,12 +413,14 @@ var conf = convict({
arg: 'node_env'
},
cluster: {
doc: 'If true, API runs in cluster mode, starting a worker for each CPU core',
doc:
'If true, API runs in cluster mode, starting a worker for each CPU core',
format: Boolean,
default: false
},
cors: {
doc: 'If true, responses will include headers for cross-domain resource sharing',
doc:
'If true, responses will include headers for cross-domain resource sharing',
format: Boolean,
default: true
},
Expand All @@ -394,7 +431,8 @@ var conf = convict({
},
databaseConnection: {
maxRetries: {
doc: 'The maximum number of times to reconnection attempts after a database fails',
doc:
'The maximum number of times to reconnection attempts after a database fails',
format: Number,
default: 10
}
Expand Down Expand Up @@ -422,6 +460,20 @@ var conf = convict({
format: Boolean,
default: true
}
},
workQueue: {
debounceTime: {
doc:
'The amount of idle time (in ms) required for the work queue to start a background job',
format: Number,
default: 500
},
pollingTime: {
doc:
'The interval (in ms) at which the work queue checks for new background jobs',
format: Number,
default: 200
}
}
})

Expand All @@ -430,7 +482,7 @@ var env = conf.get('env')
conf.loadFile('./config/config.' + env + '.json')

// Load domain-specific configuration
conf.updateConfigDataForDomain = function (domain) {
conf.updateConfigDataForDomain = function(domain) {
var domainConfig = './config/' + domain + '.json'

try {
Expand All @@ -447,6 +499,6 @@ conf.updateConfigDataForDomain = function (domain) {
}

module.exports = conf
module.exports.configPath = function () {
module.exports.configPath = function() {
return './config/config.' + conf.get('env') + '.json'
}
6 changes: 5 additions & 1 deletion config/config.test.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@
},
"feedback": false,
"cors": false,
"cluster": false
"cluster": false,
"workQueue": {
"debounceTime": 0,
"pollingTime": 0
}
}
Loading

0 comments on commit 4c92400

Please sign in to comment.