Skip to content
This repository was archived by the owner on Feb 10, 2019. It is now read-only.

Commit b01dda0

Browse files
committed
Adds ENV vars for web/api, and sets up for now deployment
1 parent 9fe51e1 commit b01dda0

File tree

6 files changed

+479
-380
lines changed

6 files changed

+479
-380
lines changed

next.config.js

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
const withTypescript = require('@zeit/next-typescript')
2-
module.exports = withTypescript()
1+
require("dotenv").config()
2+
3+
const path = require("path")
4+
const Dotenv = require("dotenv-webpack")
5+
6+
const currentExport = {
7+
webpack: config => {
8+
config.plugins = config.plugins || []
9+
10+
config.plugins = [
11+
...config.plugins,
12+
13+
// Read the .env file
14+
new Dotenv({
15+
path: path.join(__dirname, ".env"),
16+
systemvars: true,
17+
}),
18+
]
19+
20+
return config
21+
},
22+
}
23+
24+
const withTypescript = require("@zeit/next-typescript")
25+
module.exports = withTypescript(currentExport)

now.staging.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "peril-systems",
3+
"alias": ["staging.peril.systems"],
4+
"type": "npm",
5+
"public": false,
6+
"env": {
7+
"PUBLIC_API_ROOT_URL": "https://staging-api.peril.systems",
8+
"PUBLIC_WEB_ROOT_URL": "https://staging.peril.systems"
9+
}
10+
}

package.json

+37-17
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@
1313
"start": "next start"
1414
},
1515
"dependencies": {
16-
"@types/react-dom": "^16.0.4",
17-
"@zeit/next-typescript": "^0.0.10",
16+
"@types/react-dom": "^16.0.5",
17+
"@zeit/next-typescript": "^0.1.1",
18+
"dotenv-webpack": "^1.5.5",
1819
"husky": "^0.14.3",
19-
"jest": "^22.3.0",
20-
"lint-staged": "^6.1.1",
21-
"next": "^5.0.0",
22-
"react": "^16.2.0",
23-
"react-dom": "^16.2.0",
24-
"ts-jest": "^22.0.4",
25-
"typescript": "^2.7.2"
20+
"install": "^0.11.0",
21+
"jest": "^22.4.3",
22+
"lint-staged": "^7.0.4",
23+
"next": "^5.1.0",
24+
"react": "^16.3.2",
25+
"react-dom": "^16.3.2",
26+
"ts-jest": "^22.4.4",
27+
"typescript": "^2.8.3"
2628
},
2729
"devDependencies": {
28-
"@types/jest": "^22.1.3",
29-
"@types/react": "^16.0.38",
30-
"prettier": "^1.10.2",
30+
"@types/jest": "^22.2.3",
31+
"@types/react": "^16.3.12",
32+
"prettier": "^1.12.1",
3133
"tslint": "^5.9.1"
3234
},
3335
"prettier": {
@@ -42,12 +44,30 @@
4244
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
4345
},
4446
"testRegex": "(.test)\\.(ts|tsx)$",
45-
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"]
47+
"moduleFileExtensions": [
48+
"ts",
49+
"tsx",
50+
"js",
51+
"jsx",
52+
"json"
53+
]
4654
},
4755
"lint-staged": {
48-
"*.json": ["yarn prettier --write", "git add"],
49-
"*.ts": ["tslint --fix", "yarn prettier --write", "git add"],
50-
"*test.ts": ["jest -u"],
51-
"*.md": ["yarn prettier --write", "git add"]
56+
"*.json": [
57+
"yarn prettier --write",
58+
"git add"
59+
],
60+
"*.ts": [
61+
"tslint --fix",
62+
"yarn prettier --write",
63+
"git add"
64+
],
65+
"*test.ts": [
66+
"jest -u"
67+
],
68+
"*.md": [
69+
"yarn prettier --write",
70+
"git add"
71+
]
5272
}
5373
}

pages/dashboard/index.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default () => (
2+
<html>
3+
<body>
4+
<h2>Hi</h2>
5+
</body>
6+
</html>
7+
)

pages/index.tsx

+25-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
export default () => (
2-
<html>
3-
<body>
4-
<div style={{ textAlign: "center", paddingTop: "90px", fontFamily: "Avenir Next" }}>
5-
<p>Beware of</p>
6-
<p>
7-
<img src="http://danger.systems/images/js/[email protected]" />
8-
</p>
9-
</div>
10-
</body>
11-
</html>
12-
)
1+
export default () => {
2+
const thisServer = process.env.PUBLIC_WEB_ROOT_URL
3+
const dashboardURL = thisServer + "/dashboard"
4+
const loginURL =
5+
process.env.PUBLIC_API_ROOT_URL + "/api/auth/peril/github/start?redirect=" + encodeURIComponent(dashboardURL)
6+
const addPerilURL = process.env.PUBLIC_API_ROOT_URL + "/api/integrate/github"
7+
return (
8+
<html>
9+
<body>
10+
<div style={{ textAlign: "center", paddingTop: "90px", fontFamily: "Avenir Next" }}>
11+
<p>Say hi to</p>
12+
<p>
13+
<img src="http://danger.systems/images/js/[email protected]" />
14+
</p>
15+
<p>
16+
<a href={loginURL}>Login to staging</a>
17+
</p>
18+
<p>
19+
<a href={addPerilURL}>Add Peril to your org</a>
20+
</p>
21+
</div>
22+
</body>
23+
</html>
24+
)
25+
}

0 commit comments

Comments
 (0)