Skip to content

Commit

Permalink
feat: add configurable media collection name
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Dec 19, 2016
1 parent 12cd39c commit c038a58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ var conf = convict({
format: Boolean,
default: false
},
collection: {
doc: 'The name of the API collection to store the metadata for uploaded media',
format: String,
default: 'mediaStore'
},
storage: {
doc: 'Determines the storage type for uploads',
format: ['disk', 's3'],
Expand Down
4 changes: 3 additions & 1 deletion dadi/lib/controller/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var streamifier = require('streamifier')
var Model = require(path.join(__dirname, '/../model'))
var StorageFactory = require(path.join(__dirname, '/../storage/factory'))

var collectionName = config.get('media.collection')

var schema = {
'fields': {
'fileName': {
Expand Down Expand Up @@ -54,7 +56,7 @@ var schema = {
}

var MediaController = function () {
this.model = Model('_media', schema.fields, null, schema.settings, null)
this.model = Model(collectionName, schema.fields, null, schema.settings, null)
}

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

0 comments on commit c038a58

Please sign in to comment.