Commit 74f19795 authored by supermikii's avatar supermikii
Browse files

refactor environmental variable on demo frontend

parent 0a913d81
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -66,11 +66,12 @@ npm i
cd ~/AdvantEDGE/examples/demo3/src/client
npm i 
```
4. Set up your .env.local file with values of where demo 3 backend is served  
4. Set up your .env file with values of where demo 3 backend is served  
```
cd AdvantEdge/examples/demo3/src
# Create a file called .env.local
# Modify .env
# Apply configurations 
ENVIRONMENT=SANDBOX
URL=http://<my-ip-address>:<my-demo3-port-number>
```
5. Run demo 3 in development mode or build into binaries
@@ -89,7 +90,7 @@ Demo server is a web server that will run internally in AdvantEdge as the backen

The following steps need to be done prior to using this scenario

#### Obtain demo binaries
#### Configure demo frontend and obtain binaries

##### Build from source

@@ -137,7 +138,7 @@ A quick look at the top-level relevant files and directories in demo 3 project.
         ├── src
              ├── js
              ├── css
              ├── .env.local
              ├── .env
    ├── client
          ├── node_modules 
          
+2 −1
Original line number Diff line number Diff line
URL=http://10.190.115.162:8093/
ENVIRONMENT=
URL=
+9 −3
Original line number Diff line number Diff line
@@ -42,8 +42,14 @@ export default function Homepage() {
  // MEEP Demo REST API JS Client 
  // Configure server url based on environmental variable externally or preset internally

  // var basepath = process.env.URL;
  var basepath = 'http://' + location.host + location.pathname;
  var basepath; 
  if (process.env.ENVIRONMENT === 'SANDBOX') {
    basepath = process.env.URL;
  } else {
    basepath = 'http://' + location.host + location.pathname;
  }
  
  
  demoSvcRestApiClient.ApiClient.instance.basePath = basepath.replace(
    /\/+$/,
    ''