2015-09-20 23:17:06 -07:00
|
|
|
import { FileStore } from './filestore';
|
2015-09-26 14:21:42 -07:00
|
|
|
import { DatabaseStore } from './dbstore';
|
2015-09-30 21:55:45 -07:00
|
|
|
import Config from '../config';
|
2015-09-20 23:17:06 -07:00
|
|
|
|
2015-09-30 21:55:45 -07:00
|
|
|
const CHANNEL_STORE = loadChannelStore();
|
2015-09-20 23:17:06 -07:00
|
|
|
|
|
|
|
|
export function load(channelName) {
|
|
|
|
|
return CHANNEL_STORE.load(channelName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function save(channelName, data) {
|
|
|
|
|
return CHANNEL_STORE.save(channelName, data);
|
|
|
|
|
}
|
2015-09-30 21:55:45 -07:00
|
|
|
|
|
|
|
|
function loadChannelStore() {
|
|
|
|
|
switch (Config.get('channel-storage.type')) {
|
|
|
|
|
case 'database':
|
|
|
|
|
return new DatabaseStore();
|
|
|
|
|
case 'file':
|
|
|
|
|
default:
|
|
|
|
|
return new FileStore();
|
|
|
|
|
}
|
|
|
|
|
}
|