[next] Heroku Support (#2240)

* feat: added env-rewrite support

* feat: added heroku support via app.json

* fix: fixed readme linting error

* fix: fixed error in app.json

* fix: improved environment variables exposed by app.json
This commit is contained in:
Wyatt Johnson
2019-03-22 20:29:02 +00:00
committed by GitHub
parent 538e1fca9d
commit e0627925fb
7 changed files with 138 additions and 59 deletions
+3 -2
View File
@@ -59,7 +59,7 @@ const config = convict({
env: "LOCALE",
},
enable_graphiql: {
doc: "When true, this will enable the GraphiQL routes",
doc: "When true, this will enable the GraphiQL interface at /graphiql",
format: Boolean,
default: false,
env: "ENABLE_GRAPHIQL",
@@ -103,7 +103,8 @@ const config = convict({
sensitive: true,
},
signing_secret: {
doc: "",
doc:
"The shared secret to use to sign JSON Web Tokens (JWT) with the selected signing algorithm.",
format: "*",
default: "keyboard cat", // TODO: (wyattjoh) evaluate best solution
env: "SIGNING_SECRET",
+10
View File
@@ -1,4 +1,5 @@
import dotenv from "dotenv";
import { rewrite } from "env-rewrite";
import sourceMapSupport from "source-map-support";
// Configure the source map support so stack traces will reference the source
@@ -7,6 +8,15 @@ sourceMapSupport.install({
environment: "node",
});
// Ensure that we always process the rewrites silently, otherwise it may fail in
// environments like Heroku.
process.env.REWRITE_ENV_SILENT = "TRUE";
// Perform rewrites to the runtime environment variables based on the contents
// of the process.env.REWRITE_ENV if it exists. This is done here as it is the
// entrypoint for the entire applications configuration.
rewrite();
// Apply all the configuration provided in the .env file if it isn't already in
// the environment.
dotenv.config();
+3
View File
@@ -0,0 +1,3 @@
declare module "env-rewrite" {
export function rewrite(): void;
}