Merge pull request #375 from mirumee/fix/require-api-uri

Throw error when API_URI is not set
This commit is contained in:
Marcin Gębala 2020-01-17 16:09:45 +01:00 committed by GitHub
commit b5a4542d01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View file

@ -24,6 +24,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Add table sorting - #292 by @dominik-zeglen - Add table sorting - #292 by @dominik-zeglen
- Unify dialog handling - #296 by @dominik-zeglen - Unify dialog handling - #296 by @dominik-zeglen
- Stop using deprecated fields - #357 by @dominik-zeglen - Stop using deprecated fields - #357 by @dominik-zeglen
- Throw error when API_URI is not set - #375 by @dominik-zeglen
## 2.0.0 ## 2.0.0

View file

@ -3,7 +3,7 @@ import { SearchVariables } from "./hooks/makeSearch";
import { ListSettings, ListViews } from "./types"; import { ListSettings, ListViews } from "./types";
export const APP_MOUNT_URI = process.env.APP_MOUNT_URI || "/"; export const APP_MOUNT_URI = process.env.APP_MOUNT_URI || "/";
export const API_URI = process.env.API_URI || "/graphql/"; export const API_URI = process.env.API_URI;
export const DEFAULT_INITIAL_SEARCH_DATA: SearchVariables = { export const DEFAULT_INITIAL_SEARCH_DATA: SearchVariables = {
after: null, after: null,

View file

@ -35,6 +35,10 @@ module.exports = (env, argv) => {
let fileLoaderPath; let fileLoaderPath;
let output; let output;
if(!process.env.API_URI) {
throw new Error("Environment variable API_URI not set")
}
if (!devMode) { if (!devMode) {
const publicPath = process.env.STATIC_URL || "/"; const publicPath = process.env.STATIC_URL || "/";
output = { output = {