Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use domain env var instead of static domain #4

Open
wants to merge 2 commits into
base: explorerv3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORT = 4000
NODE_ENV = development

DOMAIN = epiccash.com
# DB Properties

TESTNET_DB_PORT = 5432
Expand All @@ -24,3 +24,4 @@ TIME_ZONE = utc

REDIS_KEY = explorer2
REDIS_EXPIRY = 60

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
/live/
33 changes: 19 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
@@ -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];
Expand All @@ -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;
});
});

}
});
}

});
2 changes: 1 addition & 1 deletion src/app/view/location/location.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
5 changes: 3 additions & 2 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '[email protected]',
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`.
Expand Down