diff --git a/.env b/.env index af781da..d077fe9 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ PORT = 4000 NODE_ENV = development - +DOMAIN = epiccash.com # DB Properties TESTNET_DB_PORT = 5432 @@ -24,3 +24,4 @@ TIME_ZONE = utc REDIS_KEY = explorer2 REDIS_EXPIRY = 60 + diff --git a/.gitignore b/.gitignore index f4f46a5..cd76f67 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ testem.log # System Files .DS_Store Thumbs.db +/live/ diff --git a/app.js b/app.js index 235c4f6..4c9262e 100644 --- a/app.js +++ b/app.js @@ -1,13 +1,18 @@ +import { resolve } from 'path'; +import { config } from 'dotenv'; var request = require('request'); -const fs = require("fs"); -request('https://explorer.epiccash.com/epic_explorer/v1/blockchain_kernel/getpeers', function(error, response, body){ +const fs = require("fs"); + +config({ path: resolve('.env') }); + +request(`${process.env.DOMAIN}/epic_explorer/v1/blockchain_kernel/getpeers`, function(error, response, body){ const resps = JSON.parse(body); const dataJson = resps.response.dataJson; console.log(dataJson.length); if (dataJson.length > 0) { - fs.readFile("./src/assets/geojson.json", function(err, data) { + fs.readFile("./src/assets/geojson.json", function(err, data) { const users = JSON.parse(data); - + for (let i = 0; i < dataJson.length; i++) { var ddd = []; const getIP = dataJson[i].addr.split(':')[0]; @@ -16,24 +21,24 @@ request('https://explorer.epiccash.com/epic_explorer/v1/blockchain_kernel/getpee const ipLatitude = ipResp.geo.latitude; const ipLongitude = ipResp.geo.longitude; - if (err) throw err; - // Converting to JSON + if (err) throw err; + // Converting to JSON let user = { "longitude": ipLongitude, "latitude": ipLatitude } - - ddd.push(user); + + ddd.push(user); users.locations = ddd; - fs.writeFile("./src/assets/geojson.json", JSON.stringify(users), err => { - // Checking for errors - if (err) throw err; - }); + fs.writeFile("./src/assets/geojson.json", JSON.stringify(users), err => { + // Checking for errors + if (err) throw err; + }); }); - + } }); } - + }); diff --git a/src/app/view/location/location.component.ts b/src/app/view/location/location.component.ts index 8879523..e06d45e 100644 --- a/src/app/view/location/location.component.ts +++ b/src/app/view/location/location.component.ts @@ -75,7 +75,7 @@ export class LocationComponent implements AfterViewInit { } private fetchLocationData(): void { - this.http.get('https://explorer.epiccash.com/epic_explorer/v1/blockchain_block/v1/peers/all').subscribe((data: any) => { + this.http.get('/epic_explorer/v1/blockchain_block/v1/peers/all').subscribe((data: any) => { this.locations = data.response; this.addMarkers(); }); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 8b49661..e0e3182 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,12 +4,13 @@ export const environment = { production: false, - domain: 'https://explorer.epiccash.com:8080/', - apiUrl: 'https://explorer.epiccash.com:8080/epic_explorer/v1', + domain: '/', + apiUrl: '/epic_explorer/v1', EMAIL : 'contact@epiccash.com', TARGETBLOCK: 480960 }; + /* * For easier debugging in development mode, you can import the following file * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.