haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.02k stars 662 forks source link

Config override feature works only for plugins #1467

Closed gramakri closed 8 years ago

gramakri commented 8 years ago

Not sure if this is by design or a bug.

With the latest release of haraka, we get the config override feature where I can pass a config directory using -i and haraka will pick up configs from that directory and fallback to the default configs.

This feature only works for plugins from what I can tell. The core modules like outbound.js do not read the config from the haraka defaults and always read from the -i directory.

I debugged a little and reason is that plugins.js gets a config using config.module_config. The core modules, however, simple use config.js. The default instance of config.js has a undefined root_path and thus uses the cfreader.config_path which is the -i directory.

gramakri commented 8 years ago

For a quick test, notice that when launching haraka with -i myconfig, the outbound.bounce_message read by outbound.js is empty (since myconfig does not have that file). It does not pick up outbound.bounce_message from the haraka install.

gramakri commented 8 years ago

A quick grep suggests that the following core modules are affected. These modules won't use the default configs from the haraka installation.

connection.js:var config      = require('./config');
logger.js:var config    = require('./config');
mailbody.js:var config = require('./config');
net_utils.js:var config = require('./config');
outbound.js:var config      = require('./config');
result_store.js:var config = require('./config');
server.js:var config      = require('./config');
smtp_client.js:var config      = require('./config');
tls_socket.js:var config    = require('./config');
transaction.js:var config = require('./config');
baudehlo commented 8 years ago

Bug for sure.

On May 18, 2016, at 1:17 AM, Girish Ramakrishnan notifications@github.com wrote:

Not sure if this is by design or a bug.

With the latest release of haraka, we get the config override feature where I can pass a config directory using -i and haraka will pick up configs from that directory and fallback to the installation configs.

This feature only works for plugins from what I can tell. The core modules like outbound.js do not read the config from the haraka installation and always read from the -i directory.

I debugged a little and reason is that plugins.js gets a config using config.module_config. The core modules, however, simple use config.js. The default instance of config.js has a undefined root_path and thus uses the cfreader.config_path which is the -i directory.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub