diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..d179308f1 --- /dev/null +++ b/.env.example @@ -0,0 +1,13 @@ +## +# EXAMPLE +# +# Read more about .env files when using create-react-app here: +# https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env +# + +PUBLIC_URL=/demo + +# +# Most vars require REACT_APP_* naming +# +REACT_APP_CONFIG=config/netlify.js diff --git a/.env.production b/.env.production deleted file mode 100644 index 464ee6dc5..000000000 --- a/.env.production +++ /dev/null @@ -1,14 +0,0 @@ -## -# PRODUCTION: Netlify -# -# We're using this to set variables for our Netlify deploy. -# Please feel free to delete or modify this file for your own production -# environment. Be careful not to commit anything sensitive to source control. -# - -PUBLIC_URL=/demo - -# -# Most vars require REACT_APP_* naming -# -REACT_APP_CONFIG=config/netlify.js diff --git a/docs/latest/deployment/recipes/build-for-production.md b/docs/latest/deployment/recipes/build-for-production.md index 6ab01c731..20864d125 100644 --- a/docs/latest/deployment/recipes/build-for-production.md +++ b/docs/latest/deployment/recipes/build-for-production.md @@ -70,15 +70,18 @@ how to configure the project for your own imaging archive below. > ["Set up a local DICOM server"](./../../essentials/getting-started.md#set-up-a-local-dicom-server), > or a deployment recipe that contains an open source Image Archive -#### How It Works +#### How it Works The configuration for our project is in the `/public/config` directory. Our build process knows which configuration file to use based on the `REACT_APP_CONFIG` environment variable. By default, its value is [`default.js`](https://github.com/OHIF/Viewers/blob/react/public/config/default.js). When we build, the `%REACT_APP_CONFIG%` value in -our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15)`file is substituted for the correct configuration file's name. Ultimately setting the`window.config` -equal to our configuration file's value. +our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15) +file is substituted for the correct configuration file's name. This sets +the`window.config` equal to our configuration file's value. + +#### How do I configure my project? - Modify its values directly - Create a new config file, and set the `REACT_APP_CONFIG` environement variable diff --git a/package.json b/package.json index 68929a2ae..dd2e7978c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c", "build:package:ci": "yarn run preBuild && cross-env REACT_APP_CONFIG=config/default.js node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c", "build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build", - "build:web:ci": "yarn run preBuild && react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose", + "build:web:ci": "yarn run preBuild && cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose", "lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}", "test": "jest", "test:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",