
/**
 * Access important secrets.
 */

module.exports = function(state, action, callback) {
  var account = state.context.account
  var service = action.input['Service name']

  var dbaction = {
    type: 'MongoDB initialize',
    input: {
      'Mongo URI': state.env.MONGO_URI
    }
  }

  state.dispatch(dbaction, function(err, db){
    var query = {
      account: account,
      service: service
    }
    // config.land
    db.collection('config').findOne(query, function(err, doc){
      callback(err, doc)
    })
  })
}
