Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Add hapi-require-https. #184

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Hapi = require('hapi');
const vision = require('vision');
const inert = require('inert');
const sitemap = require('hapi-sitemap');
const requireHttps = require('hapi-require-https');

const handlebarsHelperSRI = require('handlebars-helper-sri');
let handlebars = require('handlebars');
Expand Down Expand Up @@ -145,6 +146,15 @@ server.register(inert, () => {
});
});

if (process.env.NODE_ENV === 'production') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could check here for another environment variable if present. Not sure if Heroku is used and what is set exactly, so let me know.

server.register({
register: requireHttps,
options: {
proxy: false
}
});
}

server.register({
register: sitemap,
options: {
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@
"eslint": "eslint .",
"stylelint": "stylelint \"**/*.css\"",
"lint": "npm run stylelint && npm run eslint",
"mocha": "mocha test",
"start": "cross-env NODE_ENV=production node ./index.js",
"start-dev": "cross-env NODE_ENV=development node ./index.js",
"mocha": "mocha",
"server": "node ./index.js",
"start": "cross-env NODE_ENV=production npm run server",
"test": "npm run copyright && npm run lint && npm run mocha",
"travis": "nyc npm test",
"watch": "nodemon index.js --ext css,js,html --exec \"npm run start-dev\""
"watch": "nodemon index.js --ext css,js,html --exec \"npm run server\""
},
"dependencies": {
"cross-env": "^5.2.0",
"handlebars": "^4.1.1",
"handlebars-helper-sri": "0.0.0",
"hapi": "^16.6.3",
"hapi-require-https": "^2.1.0",
"hapi-sitemap": "^1.0.3",
"inert": "^4.2.1",
"sri-toolbox": "^0.2.0",
Expand Down