1 | /*
|
2 | ExpressJS for volebo.net
|
3 |
|
4 | Copyright (C) 2016-2017 Volebo <dev@volebo.net>
|
5 | Copyright (C) 2016-2017 Koryukov Maksim <maxkoryukov@gmail.com>
|
6 |
|
7 | This program is free software: you can redistribute it and/or modify
|
8 | it under the terms of the GNU General Public License as published by
|
9 | the Free Software Foundation, either version 3 of the License, or
|
10 | (at your option) any later version.
|
11 |
|
12 | This program is distributed in the hope that it will be useful,
|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 | GNU General Public License for more details.
|
16 |
|
17 | You should have received a copy of the GNU General Public License
|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 | */
|
20 |
|
21 | ;
|
22 |
|
23 | const _d = 'development';
|
24 | const _p = 'production';
|
25 |
|
26 | const _knownEnv = {
|
27 | 'production' : _p,
|
28 | 'prod' : _p,
|
29 |
|
30 | 'development' : _d,
|
31 | 'dev' : _d,
|
32 | }
|
33 |
|
34 | // Load environment:
|
35 | exports = module.exports = function getEnv() {
|
36 | let env = process.env.NODE_ENV || _d;
|
37 | env = env.toString().toLowerCase();
|
38 | if (env in _knownEnv) {
|
39 | env = _knownEnv[env];
|
40 | } else {
|
41 | env = _d;
|
42 | }
|
43 |
|
44 | let isProduction = env === _p;
|
45 | return [env, isProduction];
|
46 | }
|