Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
feat: add config file with envalid validation
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
  • Loading branch information
mikemurray committed Mar 31, 2020
1 parent 59615e3 commit 5872f91
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/config.js
@@ -0,0 +1,28 @@
import envalid from "envalid";

const config = {
PUBLIC_GRAPHQL_API_URL: process.env.PUBLIC_GRAPHQL_API_URL,
PUBLIC_OIDC_CLIENT_ID: process.env.PUBLIC_OIDC_CLIENT_ID,
PUBLIC_OIDC_URL: process.env.PUBLIC_OIDC_URL,
PUBLIC_ROOT_URL: process.env.PUBLIC_ROOT_URL
};

export default envalid.cleanEnv(config, {
PUBLIC_GRAPHQL_API_URL: envalid.str({
desc: "A URL that is accessible from browsers and accepts GraphQL POST requests over HTTP",
example: "http://localhost:3000/graphql"
}),
PUBLIC_OIDC_CLIENT_ID: envalid.str({
default: "reaction-admin-core",
desc: "The OAuth2 client ID to use for authentication flows from the browser",
example: "reaction-admin-core"
}),
PUBLIC_OIDC_URL: envalid.url({
desc: "An OAuth2 OpenID Connect compliant URL",
example: "http://localhost:4444"
}),
PUBLIC_ROOT_URL: envalid.url({
desc: "The canonical root URL for the Reaction Admin Core site",
example: "http://localhost:8081"
})
});

0 comments on commit 5872f91

Please sign in to comment.