Skip to content

Commit 2da266e

Browse files
committed
env vars 7
1 parent 949a45a commit 2da266e

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"jest:watch": "npm run jest -- --watch --no-cache",
88
"test": "mocha --reporter spec __tests__/**/*.test.js",
99
"test:watch": "npm run test -- --watch",
10-
"dev": "next -r dotenv/config",
10+
"dev": "next",
1111
"build": "next build",
1212
"watch": "nodemon server.js -w server.js",
1313
"start": "next start -p $PORT",

pages/index.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ import defaultPage from '../hocs/defaultPage'
88
import styled from 'styled-components'
99
import TodoInput from '../components/todo/todoInput'
1010
import { injectGlobal } from 'styled-components';
11-
let env = process.env.NODE_ENV || 'development'
12-
const CLIENT_ID = (env === 'production') ? process.env.AUTH0_CLIENT_ID : config.AUTH0_CLIENT_ID
13-
console.log(CLIENT_ID)
14-
console.log(typeof CLIENT_ID)
15-
injectGlobal`
16-
body {
17-
margin: 0;
18-
}
19-
`;
2011

2112
// const rule1 = {
2213
// backgroundColor: 'blue',
@@ -35,6 +26,7 @@ injectGlobal`
3526
// font-size:18px;
3627
// }
3728
// `
29+
3830
const Title = styled.h1`${{
3931
color: 'red',
4032
fontSize: '50px',

server.js

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ app.prepare()
1919

2020
expressServer.get('/other', (req, res) => {
2121
// console.log(serverLock.getBaseUrl(req));
22+
23+
24+
req.query = {
25+
text: "spencer"
26+
}
27+
28+
console.log(req.query)
2229
return app.render(req, res, '/other', req.query)
2330
})
2431

@@ -27,6 +34,7 @@ app.prepare()
2734
// console.log(JSON.stringify(req.secure, null, 2));
2835
// console.log('headers'.red);
2936
// console.log(JSON.stringify(req.headers, null, 2));
37+
3038
return app.render(req, res, '/', req.query)
3139
})
3240

utils/lock.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
let env = process.env.NODE_ENV || 'development'
21

32
const getLock = (options) => {
43
const config = require('../config.json')
54
const Auth0Lock = require('auth0-lock').default
65

7-
// if(env === 'development' || env === 'test'){
8-
// return new Auth0Lock(config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_DOMAIN, options)
9-
// }
10-
11-
const CLIENT_ID = (env === 'production') ? process.env.AUTH0_CLIENT_ID : config.AUTH0_CLIENT_ID
12-
const DOMAIN = (env === 'production') ? process.env.AUTH0_DOMAIN : config.AUTH0_CLIENT_ID
13-
// return new Auth0Lock(AUTH0_CLIENT_ID, AUTH0_CLIENT_DOMAIN, options)
14-
return new Auth0Lock(CLIENT_ID, DOMAIN, options)
6+
return new Auth0Lock( config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_DOMAIN, options)
157
}
168

179
const getBaseUrl = () => `${window.location.protocol}//${window.location.host}`

0 commit comments

Comments
 (0)