forked from haraka/Haraka
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
26 lines (21 loc) · 757 Bytes
/
Copy pathconfig.js
File metadata and controls
26 lines (21 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"use strict";
var configloader = require('./configfile');
var path = require('path');
var logger = require('./logger');
var config = exports;
var config_path = process.env.HARAKA ? path.join(process.env.HARAKA, 'config') : path.join(__dirname, './config');
config.get = function(name, type, cb) {
if (type === 'nolog') {
type = arguments[2]; // deprecated - TODO: remove later
}
type = type || 'value';
var full_path = path.resolve(config_path, name);
var results = configloader.read_config(full_path, type, cb);
// Pass arrays by value to prevent config being modified accidentally.
if (Array.isArray(results)) {
return results.slice();
}
else {
return results;
}
};