Skip to content

Commit

Permalink
modifications based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvyre committed Jan 23, 2020
1 parent 1074030 commit e4c5a12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/backend/login/usingPassport.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ SAML2_REDIRECT_URI=http://localhost:3000/oauth/callback
*/
let cert = null;

const SAML2_BASE_URI = process.env.SAML2_BASE_URI || '';
const { SAML2_REDIRECT_URI } = process.env;
const { SAML2_BASE_URI, SAML2_REDIRECT_URI } = process.env;

try {
cert = fs.readFileSync(path.resolve(process.cwd(), './certs/key.pem'), 'utf8');
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require('../lib/config');
let logLevel = (process.env.LOG_LEVEL || 'info').toLowerCase();
if (!pino.levels.values[logLevel]) {
// Use `debug` by default in development mode, `info` otherwise.
logLevel = !process.env.NODE_ENV || process.env.NODE_ENV === 'development' ? 'debug' : 'info';
logLevel = process.env.NODE_ENV === 'development' ? 'debug' : 'info';
}

const options = {
Expand Down
11 changes: 8 additions & 3 deletions src/backend/utils/wiki-feed-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ const { JSDOM } = jsdom;
* That data is then returned as a Promise
*/
module.exports.getData = function() {
return fetch(
process.env.FEED_URL || 'https://wiki.cdot.senecacollege.ca/wiki/Planet_CDOT_Feed_List'
)
let url = process.env.FEED_URL;

if (!url) {
url = 'https://wiki.cdot.senecacollege.ca/wiki/Planet_CDOT_Feed_List';
logger.debug(`No value found for FEED_URL in env, using default ${url} instead`);
}

return fetch(url)
.then(res => res.text())
.then(data => {
const dom = new JSDOM(data);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/web/routes/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ router.use(cookieParser());
router.use(bodyParser.urlencoded({ extended: false }));
router.use(bodyParser.json());

const SAML2_CLIENT_SECRET = process.env.SAML2_CLIENT_SECRET || 'secret';
const { SAML2_CLIENT_SECRET } = process.env;
router.use(session({ secret: SAML2_CLIENT_SECRET, resave: false, saveUninitialized: true }));

passport.use('samlStrategy', samlStrategy);
Expand Down

0 comments on commit e4c5a12

Please sign in to comment.