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

use single .env#169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/env
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletionsrc/environment.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
require('dotenv').config({
path: './.env',
path: './web-app/.env',
})

interface Environment {
VERSION: string
NODE_ENV: string
LOG: boolean
API_URL: string
}

const environment: Environment = {
VERSION: process.env.VERSION || 'unknown',
NODE_ENV: process.env.NODE_ENV || 'production',
LOG: (process.env.LOG || '').toLowerCase() === 'true',
API_URL: process.env.REACT_APP_GQL_URI || '',
}

export default environment
3 changes: 2 additions & 1 deletionsrc/webview/render.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ import { JSDOM } from 'jsdom'
import * as path from 'path'
import * as vscode from 'vscode'
import onError from '../services/sentry/onError'
import environment from '../environment'

const getNonce = (): string => {
let text = ''
Expand DownExpand Up@@ -72,7 +73,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
cspMeta.content =
[
`default-src 'self'`,
`connect-src https: http:`,
`connect-src https: http: ${environment.API_URL}`,
// @ts-ignore
`font-src ${panel.webview.cspSource} http: https: data:`,
// @ts-ignore
Expand Down
15 changes: 7 additions & 8 deletionsweb-app/src/environment.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
// validate .env
//const requiredKeys = ['REACT_APP_GQL_URI']
//for (const required of requiredKeys) {
// if (!process.env[required]) {
// throw new Error(`Missing Environmental Variables: ${required}`)
// }
//}
const requiredKeys = ['REACT_APP_GQL_URI']
for (const required of requiredKeys) {
if (!process.env[required]) {
throw new Error(`Missing Environmental Variables: ${required}`)
}
}

export const GQL_URI: string =
process.env.REACT_APP_GQL_URI || 'https://33mf420q4m.execute-api.us-west-2.amazonaws.com/stage/api-stage'
export const GQL_URI: string = process.env.REACT_APP_GQL_URI || 'NO API URI PROVIDED'
export const DEBUG: boolean = (process.env.REACT_APP_DEBUG || '').toLowerCase() === 'true'
export const VERSION: string = process.env.VERSION || 'unknown'
export const NODE_ENV: string = process.env.NODE_ENV || 'production'
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp