Skip to content

Commit 7327995

Browse files
authored
Merge pull request #56 from openhacku-saboten/morio/switch_endpoint
`BASE_URL`を`env`に応じて切り替える
2 parents 677d8c0 + 6319dac commit 7327995

File tree

4 files changed

+50
-28
lines changed

4 files changed

+50
-28
lines changed

next.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const dev = process.env.NODE_ENV !== "production";
2+
3+
module.exports = {
4+
env: {
5+
baseUrl: dev
6+
? 'http://localhost:3000/api/v1'
7+
: 'https://omniscode.one/api/v1',
8+
},
9+
};

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
"scripts": {
66
"dev": "node server.js",
77
"build": "next build",
8-
"start": "next start"
8+
"start": "cross-env NODE_ENV=production node server.js"
99
},
1010
"dependencies": {
1111
"@material-ui/core": "^4.11.3",
1212
"@material-ui/icons": "^4.11.2",
1313
"@material-ui/lab": "^4.0.0-alpha.57",
14-
"@types/diff": "^5.0.0",
15-
"diff": "^5.0.0",
1614
"@monaco-editor/react": "^4.1.0",
15+
"@types/diff": "^5.0.0",
1716
"axios": "^0.21.1",
17+
"cross-env": "^7.0.3",
18+
"diff": "^5.0.0",
1819
"express": "^4.17.1",
1920
"firebase": "^8.3.1",
2021
"http-proxy-middleware": "^1.0.6",

utils/axios.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import axios from 'axios';
2+
3+
const myAxios = axios.create({
4+
baseURL: process.env.baseUrl ?? 'http://localhost:3000/api/v1',
5+
});
6+
7+
export default myAxios;

yarn.lock

+30-25
Original file line numberDiff line numberDiff line change
@@ -498,18 +498,6 @@
498498
resolved "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.14.0.tgz"
499499
integrity sha512-sDOAZcYwynHFTbLo6n8kIbLiVF3a3BLkrmehJUyEbT9F+Smbi47kLGS2gG2g0fjBLR/Lr1InPD7kXL7FaTqEkw==
500500

501-
"@types/diff@^5.0.0":
502-
version "5.0.0"
503-
resolved "https://registry.yarnpkg.com/@types/diff/-/diff-5.0.0.tgz#eb71e94feae62548282c4889308a3dfb57e36020"
504-
integrity sha512-jrm2K65CokCCX4NmowtA+MfXyuprZC13jbRuwprs6/04z/EcFg/MCwYdsHn+zgV4CQBiATiI7AEq7y1sZCtWKA==
505-
506-
"@types/hast@^2.0.0":
507-
version "2.3.1"
508-
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.1.tgz#b16872f2a6144c7025f296fb9636a667ebb79cd9"
509-
integrity sha512-viwwrB+6xGzw+G1eWpF9geV3fnsDgXqHG+cqgiHrvQfDUW5hzhCyV7Sy3UJxhfRFBsgky2SSW33qi/YrIkjX5Q==
510-
dependencies:
511-
"@types/unist" "*"
512-
513501
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
514502
version "1.1.2"
515503
resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz"
@@ -563,6 +551,18 @@
563551
resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz"
564552
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=
565553

554+
"@types/diff@^5.0.0":
555+
version "5.0.0"
556+
resolved "https://registry.yarnpkg.com/@types/diff/-/diff-5.0.0.tgz#eb71e94feae62548282c4889308a3dfb57e36020"
557+
integrity sha512-jrm2K65CokCCX4NmowtA+MfXyuprZC13jbRuwprs6/04z/EcFg/MCwYdsHn+zgV4CQBiATiI7AEq7y1sZCtWKA==
558+
559+
"@types/hast@^2.0.0":
560+
version "2.3.1"
561+
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.1.tgz#b16872f2a6144c7025f296fb9636a667ebb79cd9"
562+
integrity sha512-viwwrB+6xGzw+G1eWpF9geV3fnsDgXqHG+cqgiHrvQfDUW5hzhCyV7Sy3UJxhfRFBsgky2SSW33qi/YrIkjX5Q==
563+
dependencies:
564+
"@types/unist" "*"
565+
566566
"@types/http-proxy@^1.17.4":
567567
version "1.17.5"
568568
resolved "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.5.tgz"
@@ -1295,7 +1295,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
12951295
safe-buffer "^5.0.1"
12961296
sha.js "^2.4.8"
12971297

1298-
cross-spawn@^7.0.2:
1298+
cross-env@^7.0.3:
1299+
version "7.0.3"
1300+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
1301+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
1302+
dependencies:
1303+
cross-spawn "^7.0.1"
1304+
1305+
cross-spawn@^7.0.1, cross-spawn@^7.0.2:
12991306
version "7.0.3"
13001307
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
13011308
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -1850,7 +1857,6 @@ fastq@^1.6.0:
18501857
dependencies:
18511858
reusify "^1.0.4"
18521859

1853-
18541860
fault@^1.0.0:
18551861
version "1.0.4"
18561862
resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13"
@@ -1865,7 +1871,6 @@ [email protected]:
18651871
dependencies:
18661872
websocket-driver ">=0.5.1"
18671873

1868-
18691874
file-entry-cache@^6.0.1:
18701875
version "6.0.1"
18711876
resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz"
@@ -1943,16 +1948,16 @@ flatted@^3.1.0:
19431948
resolved "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz"
19441949
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
19451950

1946-
format@^0.2.0:
1947-
version "0.2.2"
1948-
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
1949-
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=
1950-
19511951
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
19521952
version "1.13.3"
19531953
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz"
19541954
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
19551955

1956+
format@^0.2.0:
1957+
version "0.2.2"
1958+
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
1959+
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=
1960+
19561961
forwarded@~0.1.2:
19571962
version "0.1.2"
19581963
resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz"
@@ -3088,11 +3093,6 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.5:
30883093
pbkdf2 "^3.0.3"
30893094
safe-buffer "^5.1.1"
30903095

3091-
parseurl@~1.3.3:
3092-
version "1.3.3"
3093-
resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
3094-
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
3095-
30963096
parse-entities@^2.0.0:
30973097
version "2.0.0"
30983098
resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8"
@@ -3105,6 +3105,11 @@ parse-entities@^2.0.0:
31053105
is-decimal "^1.0.0"
31063106
is-hexadecimal "^1.0.0"
31073107

3108+
parseurl@~1.3.3:
3109+
version "1.3.3"
3110+
resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
3111+
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
3112+
31083113
31093114
version "0.0.1"
31103115
resolved "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz"

0 commit comments

Comments
 (0)