This repository was archived by the owner on Nov 3, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconfig.js
More file actions
88 lines (71 loc) · 2.39 KB
/
Copy pathconfig.js
File metadata and controls
88 lines (71 loc) · 2.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*global require:true, __dirname:true, process:true, console:true, module:true */
// The purpose of this file is to setup the use of
// configuration files for our node development server.
// Modules & Variables.
var nconf = require('nconf'),
fs = require('fs'),
config = {};
// Setup nconf to use (in-order) command-line arguments and environment variables.
nconf.argv().env();
// Configure nconf to use config.json file.
nconf.file({file: __dirname + '/config/config.json'});
// Supported environments are web, android and ios.
config.environment = nconf.get('environment') || 'web';
// Supported types are mock, local and cas.
config.auth = nconf.get('auth') || 'mock';
// Supported modes are dev and prod.
config.mode = nconf.get('mode') || 'dev';
// Phonegap plugins
config.plugins = nconf.get('plugins') || [];
config.beautify = nconf.get('beautify') || true;
// Performs a test on the current mode configuration
// (i.e., dev or prod).
config.isDevelopment = function () {
'use strict';
return (config.mode === 'dev') ? true : false;
};
// Returns the authentication configuration.
config.getAuth = function () {
'use strict';
return config.auth;
};
// Returns the environment configuration.
config.getEnvironment = function () {
'use strict';
return config.environment;
};
// Returns the SessionTracker needed
// based upon the environment configuration.
// The session tracker plugin is currently
// disabled with our upgrade to PhoneGap 2.5.
// This method always returns SessionTrackerMock
// until the session tracking plugins can be upgraded.
config.getTracker = function () {
'use strict';
return (config.getEnvironment() !== 'web') ? 'SessionTracker' : 'SessionTrackerMock';
};
// Returns the cordova version needed
// based upon the environment configuration.
config.getCordova = function () {
'use strict';
var theEnv = config.getEnvironment();
return (theEnv === 'web' || theEnv === 'android') ? 'android' : 'ios';
};
// Returns the public directory based upon
// the mode configuration.
config.getPublicDirectory = function () {
'use strict';
return 'www';
};
config.getOptionsForLess = function() {
'use strict';
var options = {
compress: config.isDevelopment() ? false : true,
cleancss: config.isDevelopment() ? false : true,
report: config.isDevelopment() ? 'min' : 'gzip',
optimization: config.isDevelopment() ? 1 : 5,
};
return options;
};
// Export module.
module.exports = config;