Skip to content

Commit c038a58

Browse files
committed
feat: add configurable media collection name
1 parent 12cd39c commit c038a58

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ var conf = convict({
291291
format: Boolean,
292292
default: false
293293
},
294+
collection: {
295+
doc: 'The name of the API collection to store the metadata for uploaded media',
296+
format: String,
297+
default: 'mediaStore'
298+
},
294299
storage: {
295300
doc: 'Determines the storage type for uploads',
296301
format: ['disk', 's3'],

dadi/lib/controller/media.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var streamifier = require('streamifier')
1212
var Model = require(path.join(__dirname, '/../model'))
1313
var StorageFactory = require(path.join(__dirname, '/../storage/factory'))
1414

15+
var collectionName = config.get('media.collection')
16+
1517
var schema = {
1618
'fields': {
1719
'fileName': {
@@ -54,7 +56,7 @@ var schema = {
5456
}
5557

5658
var MediaController = function () {
57-
this.model = Model('_media', schema.fields, null, schema.settings, null)
59+
this.model = Model(collectionName, schema.fields, null, schema.settings, null)
5860
}
5961

6062
MediaController.prototype.post = function (req, res, next) {

0 commit comments

Comments
 (0)