@equinor/echo-cli 1.0.0-beta-1 → 1.0.0-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ /* eslint-disable */
2
+
3
+ Never use PROCESS.ENV/process.env use env() instead. (Except for process.env.NODE_ENV)
4
+ ---------------------------------
5
+
6
+ Based on: https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/
7
+
8
+ All variables in this files are converted to env() during build, and values here are replaced
9
+ by environment variables if they exists. This is done by running the env.sh bash script before the
10
+ build.
11
+
12
+ env.sh generates env-config.js containing all the variables, which is included in index.html,
13
+ and appended to Window._env_. env() is a shortcut for Window._env_ and should be used in code.
14
+
15
+ NOTE: Seems like window._env_ is not available in a worker
16
+
17
+ */
18
+ WEBSITE_HOSTNAME=localhost:3000;
19
+ REACT_APP_DEFAULT_CACHE_LOCATION=localstorage
20
+ REACT_APP_API_URL=https://dt-echopedia-api-dev.azurewebsites.net
21
+ REACT_APP_WEB_URL=https://dt-echopedia-web-dev.azurewebsites.net
22
+ REACT_APP_WEB_PROD_URL=https://echo.equinor.com
23
+ REACT_APP_AZURE_AD_TENNANT=StatoilSRM.onmicrosoft.com
24
+ REACT_APP_AZURE_AD_TENNANT_ID=3aa4a235-b6e2-48d5-9195-7fcf05b459b0
25
+ REACT_APP_AZURE_AD_CLIENT_ID=751d2504-0b66-4b78-9807-4b60525a14c6
26
+ REACT_APP_API_CLIENT_ID=aef35d97-53d4-4fd0-adaf-c5a514b38436
27
+ REACT_APP_APPINSIGHTS_CONNECTION_STRING=InstrumentationKey=e5299075-a00d-4012-96f9-42861e8d8a9e;IngestionEndpoint=https://northeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/;ApplicationId=a9b64222-d4a9-42e6-a615-7428fe1a26af
28
+ REACT_APP_AZURE_BUILD_NUMBER=0.8.dev.9
29
+ REACT_APP_LOGGER_ACTIVE=false
@@ -0,0 +1,51 @@
1
+ #!/bin/bash
2
+
3
+ #https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/
4
+ #
5
+
6
+ # Recreate config file
7
+ rm -rf ./env-config.js
8
+ touch ./env-config.js
9
+
10
+ echo "creating env-config.js"
11
+
12
+ # Add assignment
13
+ echo "window._env_ = {" >> ./env-config.js
14
+
15
+ # Read each line in .env file
16
+ # Each line represents key=value pairs
17
+ while read -r line || [[ -n "$line" ]];
18
+ do
19
+ #only process lines containting =
20
+ if [[ $line == *"="* ]]; then
21
+
22
+ # Split env variables by character `=`
23
+ if printf '%s\n' "$line" | grep -q -e '='; then
24
+ varname=$(printf '%s\n' "$line" | sed -e 's/=.*//')
25
+ varvalue=$(printf '%s\n' "$line" | sed -e 's/^[^=]*=//')
26
+ fi
27
+
28
+ # Read value of current variable if exists as Environment variable
29
+ value=$(printf '%s\n' "${!varname}")
30
+ # Otherwise use value from .env file
31
+ [[ -z $value ]] && value=${varvalue}
32
+
33
+ # Append configuration property to JS file
34
+ echo " $varname: \"$value\"," >> ./env-config.js
35
+
36
+ #print variables
37
+ valueObfuscated=$(printf '%s' "$value" | cut -c 1-3)
38
+ #echo " $varname: \"$value\"," #print the environment variables
39
+ echo " $varname=\"$valueObfuscated***\"," #print the environment variables obfuscated
40
+ fi
41
+ done < .env
42
+
43
+ echo "}" >> ./env-config.js
44
+
45
+ #if directory exists, copy to public folder. Needed for dev enironment (npm start)
46
+ if [ -d "public" ]; then
47
+ rm -rf ./public/env-config.js
48
+ cp ./env-config.js ./public/env-config.js
49
+ fi
50
+
51
+ echo "done creating env-config.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-cli",
3
- "version": "1.0.0-beta-1",
3
+ "version": "1.0.0-beta-2",
4
4
  "description": "Command line interface for Echo Apps",
5
5
  "main": "dist/index.js",
6
6
  "source": "src/test.js",