Skip to content

Commit

Permalink
deprecate config TRIMMED_DEFINITION_MONGO_COLLECTION_NAME
Browse files Browse the repository at this point in the history
Replacement config: DEFINITION_MONGO_TRIMMED_COLLECTION_NAME

Config TRIMMED_DEFINITION_MONGO_COLLECTION_NAME was removed in PR #987.  To avoid a major change in the next release, the config was added back in and deprecated.

New processing:
* if the old config has a value, a deprecation message is written to the console
* if the new config is specified, its value is used and the old one is ignored if it exists
* if only the old config is specified, its value is used
* otherwise, if neither are specified, the default is used
  • Loading branch information
elrayle committed Feb 9, 2024
1 parent 12b5b5b commit 65b9ad9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion providers/stores/mongoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ function definitionPaged(options) {
}

function definitionTrimmed(options) {
const oldConfig = config.get('TRIMMED_DEFINITION_MONGO_COLLECTION_NAME')
if (oldConfig) {
console.warn('The TRIMMED_DEFINITION_MONGO_COLLECTION_NAME environment variable is deprecated. Use DEFINITION_MONGO_TRIMMED_COLLECTION_NAME instead.')
}
return TrimmedMongoDefinitionStore(options || {
...dbOptions,
collectionName: config.get('DEFINITION_MONGO_TRIMMED_COLLECTION_NAME') || 'definitions-trimmed'
collectionName: config.get('DEFINITION_MONGO_TRIMMED_COLLECTION_NAME') || oldConfig || 'definitions-trimmed'
})
}

Expand Down

0 comments on commit 65b9ad9

Please sign in to comment.