Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f1707a

Browse files
authored
Merge pull requestcoderoad#169 from ShMcK/feature/env
use single .env
2 parentsf662a63 +a24adca commit5f1707a

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

‎src/environment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
require('dotenv').config({
2-
path:'./.env',
2+
path:'./web-app/.env',
33
})
44

55
interfaceEnvironment{
66
VERSION:string
77
NODE_ENV:string
88
LOG:boolean
9+
API_URL:string
910
}
1011

1112
constenvironment:Environment={
1213
VERSION:process.env.VERSION||'unknown',
1314
NODE_ENV:process.env.NODE_ENV||'production',
1415
LOG:(process.env.LOG||'').toLowerCase()==='true',
16+
API_URL:process.env.REACT_APP_GQL_URI||'',
1517
}
1618

1719
exportdefaultenvironment

‎src/webview/render.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { JSDOM } from 'jsdom'
22
import*aspathfrom'path'
33
import*asvscodefrom'vscode'
44
importonErrorfrom'../services/sentry/onError'
5+
importenvironmentfrom'../environment'
56

67
constgetNonce=():string=>{
78
lettext=''
@@ -72,7 +73,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
7273
cspMeta.content=
7374
[
7475
`default-src 'self'`,
75-
`connect-src https: http:`,
76+
`connect-src https: http:${environment.API_URL}`,
7677
//@ts-ignore
7778
`font-src${panel.webview.cspSource} http: https: data:`,
7879
//@ts-ignore

‎web-app/src/environment.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// validate .env
2-
//const requiredKeys = ['REACT_APP_GQL_URI']
3-
//for (const required of requiredKeys) {
4-
// if (!process.env[required]) {
5-
// throw new Error(`Missing Environmental Variables: ${required}`)
6-
// }
7-
//}
2+
constrequiredKeys=['REACT_APP_GQL_URI']
3+
for(constrequiredofrequiredKeys){
4+
if(!process.env[required]){
5+
thrownewError(`Missing Environmental Variables:${required}`)
6+
}
7+
}
88

9-
exportconstGQL_URI:string=
10-
process.env.REACT_APP_GQL_URI||'https://33mf420q4m.execute-api.us-west-2.amazonaws.com/stage/api-stage'
9+
exportconstGQL_URI:string=process.env.REACT_APP_GQL_URI||'NO API URI PROVIDED'
1110
exportconstDEBUG:boolean=(process.env.REACT_APP_DEBUG||'').toLowerCase()==='true'
1211
exportconstVERSION:string=process.env.VERSION||'unknown'
1312
exportconstNODE_ENV:string=process.env.NODE_ENV||'production'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp