8cece4a924fa8ab17c60949548f3366dd727d3aa.svn-base
1.06 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default values
//
exports.createConfig = function (defaults) {
return new Config(defaults);
};
//
// Config (defaults)
// Constructor for the Config object
//
var Config = exports.Config = function (defaults) {
if (!defaults.subdomain) {
throw new Error('Subdomain is required to create an instance of Config');
}
this.subdomain = defaults.subdomain;
this.json = defaults.json || null;
this.auth = defaults.auth || null;
};
Config.prototype = {
get subdomain () {
return this._subdomain;
},
set subdomain (value) {
this._subdomain = value;
},
get logglyUrl () {
return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
},
get inputUrl () {
return 'https://logs.loggly.com/inputs/';
}
};