qiniu.js 635 Bytes
/**
 *
 * @author: jiangfeng<jeff.jiang@yoho.cn>
 * @date: 16/8/19
 */

'use strict';

const qn = require('qn');
const Promise = require('bluebird');
const _ = require('lodash');

const config = {
    accessKey: 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE',
    secretKey: 'RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG',
    origin: 'http://cdn.yoho.cn',
    bucket: 'yohocdn'
};


const _default = Promise.promisifyAll(qn.create(config));

_default.key = function(key) {
    let _conifg = _.clone(config);
    _conifg.bucket = _conifg.bucket + ":" + key;
    return Promise.promisifyAll(qn.create(_conifg));
};

module.exports = _default;