Skip to content

Commit

Permalink
馃帹 optimise requires for MigratorConfig (#8088)
Browse files Browse the repository at this point in the history
no issue

- if knex-migrator loads the MigratorConfig too much stuff was required, which increases the memory usage
- i have deleted the IncorrectUsage errors for now, because this error should actually never appear
  • Loading branch information
kirrg001 authored and ErisDS committed Mar 2, 2017
1 parent c70fbc2 commit 0b68458
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions MigratorConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var config = require('./core/server/config'),
utils = require('./core/server/utils');
ghostVersion = require('./core/server/utils/ghost-version');

/**
* knex-migrator can be used via CLI or within the application
Expand All @@ -8,7 +8,7 @@ var config = require('./core/server/config'),
require('./core/server/overrides');

module.exports = {
currentVersion: utils.ghostVersion.safe,
currentVersion: ghostVersion.safe,
database: config.get('database'),
migrationPath: config.get('paths:migrationPath')
};
16 changes: 1 addition & 15 deletions core/server/config/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var path = require('path'),
_ = require('lodash'),
errors = require('../errors');
_ = require('lodash');

exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
if (!this.get('privacy')) {
Expand Down Expand Up @@ -31,19 +30,6 @@ exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) {
var self = this;

if (!obj) {
throw new errors.IncorrectUsageError({
message: 'makePathsAbsolute: Can\'t make paths absolute of non existing object.',
help: parent
});
}

if (!parent) {
throw new errors.IncorrectUsageError({
message: 'makePathsAbsolute: Parent is missing.'
});
}

_.each(obj, function (configValue, pathsKey) {
if (_.isObject(configValue)) {
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey);
Expand Down

0 comments on commit 0b68458

Please sign in to comment.