UNPKG

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