2016-12-30 11:35:19 -07:00
|
|
|
import Logger from './logger';
|
2018-07-14 07:10:27 -06:00
|
|
|
import isRoot = require('is-root');
|
2016-12-30 11:35:19 -07:00
|
|
|
|
2017-01-02 12:39:44 -07:00
|
|
|
export default class {
|
2017-05-24 05:50:17 -06:00
|
|
|
public static show(): void {
|
2016-12-30 11:35:19 -07:00
|
|
|
const env = process.env.NODE_ENV;
|
2017-05-24 05:50:17 -06:00
|
|
|
const logger = new Logger('Env');
|
2016-12-30 11:35:19 -07:00
|
|
|
logger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
|
2017-05-24 05:50:17 -06:00
|
|
|
|
2016-12-30 11:35:19 -07:00
|
|
|
if (env !== 'production') {
|
|
|
|
logger.warn('The environment is not in production mode');
|
|
|
|
logger.warn('Do not use for production purpose');
|
|
|
|
}
|
2018-07-14 07:10:27 -06:00
|
|
|
|
|
|
|
logger.info(`You ${isRoot() ? '' : 'do not '}have root privileges`);
|
2016-12-30 11:35:19 -07:00
|
|
|
}
|
|
|
|
}
|