module.exports = req => {
    const envVar = process.env.CONNECT_ENVIRONMENT || process.env.NODE_ENV || 'development';

    if (req && req.config) {
        return req.config.app.env || envVar;
    }

    return envVar;
};
