Permalink
Browse files

feat: add configurable media collection name

  • Loading branch information...
jimlambie committed Dec 19, 2016
1 parent 12cd39c commit c038a582d8c2df62ee555e2d3d3541c6fed71882
Showing with 8 additions and 1 deletion.
  1. +5 −0 config.js
  2. +3 −1 dadi/lib/controller/media.js
@@ -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'],
@@ -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': {
@@ -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) {

0 comments on commit c038a58

Please sign in to comment.