Files
kami-parse-server/src/Config.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-01-28 10:58:12 -08:00
// A Config object provides information about how a specific app is
// configured.
// mount is the URL for the root of the API; includes http, domain, etc.
2016-02-24 15:55:11 -05:00
import cache from './cache';
export class Config {
constructor(applicationId: string, mount: string) {
let DatabaseAdapter = require('./DatabaseAdapter');
2016-01-28 10:58:12 -08:00
let cacheInfo = cache.apps[applicationId];
this.valid = !!cacheInfo;
if (!this.valid) {
return;
}
this.applicationId = applicationId;
this.collectionPrefix = cacheInfo.collectionPrefix || '';
this.masterKey = cacheInfo.masterKey;
this.clientKey = cacheInfo.clientKey;
this.javascriptKey = cacheInfo.javascriptKey;
this.dotNetKey = cacheInfo.dotNetKey;
this.restAPIKey = cacheInfo.restAPIKey;
this.fileKey = cacheInfo.fileKey;
this.facebookAppIds = cacheInfo.facebookAppIds;
this.enableAnonymousUsers = cacheInfo.enableAnonymousUsers;
2016-02-26 22:55:39 +08:00
this.allowClientClassCreation = cacheInfo.allowClientClassCreation;
this.database = DatabaseAdapter.getDatabaseConnection(applicationId, this.collectionPrefix);
this.hooksController = cacheInfo.hooksController;
this.filesController = cacheInfo.filesController;
this.pushController = cacheInfo.pushController;
this.loggerController = cacheInfo.loggerController;
this.oauth = cacheInfo.oauth;
2016-01-28 10:58:12 -08:00
this.mount = mount;
}
}
2016-01-28 10:58:12 -08:00
export default Config;
2016-01-28 10:58:12 -08:00
module.exports = Config;