Refactors configuration management (#4271)
* Adds flow types / Configuration interfaces * Lets call it options * Use a single interface to generate the configurations * Translates options to definitions only if comments are set * improves logic * Moves objects around * Fixes issue affecting logging of circular objects * fixes undefined env * Moves all defaults to defaults * Adds back CLI defaults * Restored defaults in commander.js * Merge provided defaults and platform defaults * Addresses visual nits * Improves Config.js code * Adds ability to pass the default value in trailing comments * Load platform defaults from the definitions file * proper default values on various options * Adds ParseServer.start and server.start(options) as quick startup methods * Moves creating liveQueryServer http into ParseServer.js * removes dead code * Adds tests to guarantee we can start a LQ Server from main module * Fixes incorrect code regading liveQuery init port * Start a http server for LQ if port is specified * ensure we dont fail if config.port is not set * Specify port * ignore other path skipped in tests * Adds test for custom middleware setting * Refactors new Config into Config.get - Hides AppCache from ParseServer.js, use Config.put which validates * Extracts controller creation into Controllers/index.js - This makes the ParseServer init way simpler * Move serverURL inference into ParseServer * review nits
This commit is contained in:
@@ -23,7 +23,7 @@ describe_only_db('mongo')('miscellaneous', () => {
|
||||
obj.set('foo', 'bar');
|
||||
return obj.save();
|
||||
}).then(() => {
|
||||
const config = new Config(appId);
|
||||
const config = Config.get(appId);
|
||||
return config.database.adapter.find('TestObject', { fields: {} }, {}, {});
|
||||
}).then((results) => {
|
||||
expect(results.length).toEqual(1);
|
||||
@@ -151,7 +151,7 @@ describe('miscellaneous', function() {
|
||||
});
|
||||
|
||||
it('ensure that if people already have duplicate users, they can still sign up new users', done => {
|
||||
const config = new Config('test');
|
||||
const config = Config.get('test');
|
||||
// Remove existing data to clear out unique index
|
||||
TestUtils.destroyAllDataPermanently()
|
||||
.then(() => config.database.adapter.createClass('_User', userSchema))
|
||||
@@ -183,7 +183,7 @@ describe('miscellaneous', function() {
|
||||
});
|
||||
|
||||
it('ensure that if people already have duplicate emails, they can still sign up new users', done => {
|
||||
const config = new Config('test');
|
||||
const config = Config.get('test');
|
||||
// Remove existing data to clear out unique index
|
||||
TestUtils.destroyAllDataPermanently()
|
||||
.then(() => config.database.adapter.createClass('_User', userSchema))
|
||||
@@ -211,7 +211,7 @@ describe('miscellaneous', function() {
|
||||
});
|
||||
|
||||
it('ensure that if you try to sign up a user with a unique username and email, but duplicates in some other field that has a uniqueness constraint, you get a regular duplicate value error', done => {
|
||||
const config = new Config('test');
|
||||
const config = Config.get('test');
|
||||
config.database.adapter.addFieldIfNotExists('_User', 'randomField', { type: 'String' })
|
||||
.then(() => config.database.adapter.ensureUniqueness('_User', userSchema, ['randomField']))
|
||||
.then(() => {
|
||||
@@ -1546,7 +1546,7 @@ describe_only_db('mongo')('legacy _acl', () => {
|
||||
},
|
||||
json: true
|
||||
}).then(() => {
|
||||
const config = new Config('test');
|
||||
const config = Config.get('test');
|
||||
const adapter = config.database.adapter;
|
||||
return adapter._adaptiveCollection("Report")
|
||||
.then(collection => collection.find({}))
|
||||
|
||||
Reference in New Issue
Block a user