Skip to content

Commit

Permalink
Merge pull request #1473 from haraka/fix_issue_1471
Browse files Browse the repository at this point in the history
Fix plugin loading override when installed
  • Loading branch information
baudehlo committed May 23, 2016
2 parents f103c41 + 2a9d200 commit f8a96e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ var cfreader = require('./configfile');

module.exports = new Config();

function Config (root_path) {
function Config (root_path, no_overrides) {
this.root_path = root_path || cfreader.config_path;
this.module_config = function (defaults_path, overrides_path) {
var cfg = new Config(path.join(defaults_path, 'config'));
var cfg = new Config(path.join(defaults_path, 'config'), true);
if (overrides_path) {
cfg.overrides_path = path.join(overrides_path, 'config');
}
return cfg;
};
if (process.env.HARAKA) {
this.overrides_path = path.join(__dirname, 'config');
if (process.env.HARAKA && !no_overrides) {
this.overrides_path = root_path || cfreader.config_path;
this.root_path = path.join(process.env.HARAKA, 'config');
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/installation/config/tls.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ciphers=test
4 changes: 3 additions & 1 deletion tests/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ exports.plugin_config = {

var p = new plugin.Plugin('tls');

test.expect(2);
test.expect(3);
test.equal(p.config.root_path, path.resolve(__dirname, '..', 'config'));
test.equal(p.config.overrides_path, path.resolve(__dirname, 'installation', 'config'));
var tls_ini = p.config.get('tls.ini');
test.equal(tls_ini.main.ciphers, 'test');
test.done();
},

Expand Down

0 comments on commit f8a96e0

Please sign in to comment.