Skip to content

Commit

Permalink
Use same config on the api side.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterp committed Jul 13, 2019
1 parent ae0e03d commit 7e7ac68
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ Browse to `http://localhost:8910` to see the web app. Lambda functions run on
`yarn hammer generate component MyShinyComponent` will create a component
and place it under `web/src/components/MyShinyComponent`

### .ENV

Auth0 requires a few environmental variables, none of those are private,
so just go ahead and use these:

```
AUTH0_DOMAIN=p4p8.eu.auth0.com
AUTH0_CLIENT_ID=b7vN4sVz6yjGrq82ctXJW9NRTvlWzkFU
AUTH0_AUDIENCE=BILLABLE_API
```

### Transpiling packages

There are a bunch of packages in this repository that will eventually be published
Expand Down
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@hammerframework/hammer-api": "0.0.0",
"apollo-server-lambda": "^2.6.2",
"dotenv": "^8.0.0",
"express-jwt": "^5.3.1",
"graphql": "^14.3.1",
"jwks-rsa": "^1.5.1",
Expand Down
9 changes: 7 additions & 2 deletions api/src/functions/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
import jwt from "express-jwt";
import jwksRsa from "jwks-rsa";

import dotenv from "dotenv";

// hammer base dir.
dotenv.config("../../.env");

// Set up Auth0 configuration
const authConfig = {
domain: "p4p8.eu.auth0.com",
audience: "BILLABLE_API"
domain: process.env.AUTH0_DOMAIN,
audience: process.env.AUTH0_AUDIENCE
};

// Define middleware that validates incoming bearer tokens
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2745,6 +2745,11 @@ dotenv@^6.2.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==

dotenv@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440"
integrity sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==

duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
Expand Down

0 comments on commit 7e7ac68

Please sign in to comment.