diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..c76e14e --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: npm run $(test "$BIBLIOGRAM_ENTRY" = 'assistant' && echo 'assistant' || echo 'start') diff --git a/src/lib/constants.js b/src/lib/constants.js index 346e799..3e76488 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -127,6 +127,11 @@ let constants = { // Override values from config and export the result const md = require("mixin-deep") -const config = require("../../config") -constants = md(constants, config) +if (process.env.BIBLIOGRAM_CONFIG) { // presence of environment variable BIBLIOGRAM_CONFIG overrides /config.js + const config = JSON.parse(process.env.BIBLIOGRAM_CONFIG) + constants = md(constants, config) +} else { + const config = require("../../config") + constants = md(constants, config) +} module.exports = constants diff --git a/src/site/assistant.js b/src/site/assistant.js index 294b1c6..22ec9a0 100644 --- a/src/site/assistant.js +++ b/src/site/assistant.js @@ -5,7 +5,7 @@ const constants = require("../lib/constants") const passthrough = require("./passthrough") const pinski = new Pinski({ - port: constants.port, + port: +process.env.PORT || constants.port, relativeRoot: __dirname }) diff --git a/src/site/server.js b/src/site/server.js index 741b5fc..8931819 100644 --- a/src/site/server.js +++ b/src/site/server.js @@ -5,7 +5,7 @@ const constants = require("../lib/constants") const passthrough = require("./passthrough") const pinski = new Pinski({ - port: constants.port, + port: +process.env.PORT || constants.port, relativeRoot: __dirname, basicCacheControl: { exts: ["ttf", "woff2", "png", "jpg", "jpeg", "svg", "gif", "webmanifest", "ico"],