Skip to content

Commit

Permalink
use env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mjadach-iv committed May 28, 2024
1 parent 7b7cbb9 commit 63ca861
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy (Production)
on:
push:
branches:
- prod
- main

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy (Staging)
on:
push:
branches:
- main
- staging

jobs:
deploy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules/
/.wrangler/
/dist/
/frontend/.env
4 changes: 4 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
REACT_APP_BACKEND_URL=tokentracker.hoprnet.workers.dev //'http://127.0.0.1:8787' if used local server
REACT_APP_uHTTP_DP_ENDPOINT= //leave empty to use default
REACT_APP_uHTTP_TOKEN=
REACT_APP_uHTTP_FORCE_ZERO_HOP=true
2 changes: 1 addition & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Logs from './Logs'
import Fingerprint from './Fingerprint';


const serverurl = 'tokentracker.hoprnet.workers.dev' //'http://127.0.0.1:8787'
const serverurl = process.env.REACT_APP_BACKEND_URL;

function App() {
return (
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/Portfolio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { useEffect, useState } from "react";
import { formatEther } from 'viem'
import humanFormat from "human-format";
import Icon from "./Icon";
import { Routing } from '@hoprnet/phttp-lib';
import millify from "millify";

const notRealTokenRegEx = /visit|www|http|.com|.org|claim/gi;

const RPChToken = 'ipE4I7B4D3nZ7Z4ZcFGkt9wt4mrZmb99IFbWaDGdT69Vriw3';
let uHTTPOptions = {
forceZeroHop: process.env.REACT_APP_uHTTP_FORCE_ZERO_HOP ? JSON.parse(process.env.REACT_APP_uHTTP_FORCE_ZERO_HOP) : false,
}

if(process.env.REACT_APP_uHTTP_DP_ENDPOINT) uHTTPOptions.discoveryPlatformEndpoint = process.env.REACT_APP_uHTTP_DP_ENDPOINT;

const uHTTP = new Routing.Routing(RPChToken, { forceZeroHop: true });
const uHTTP = new Routing.Routing(process.env.REACT_APP_uHTTP_TOKEN, uHTTPOptions);

function Portfolio({ serverurl }) {
const [ethAddress, set_ethAddress] = useState('0xC61b9BB3A7a0767E3179713f3A5c7a9aeDCE193C');
Expand All @@ -19,6 +22,7 @@ function Portfolio({ serverurl }) {
const [use_uHTTP, set_use_uHTTP] = useState(false);
const [iteration, set_iteration] = useState(0);

// Testing
// useEffect(()=>{
// const x = {
// "address": "0x11b815efb8f581194ae79006d24e0d814b7697f6",
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
"types:check": "tsc",
"start-local-ssl-proxy": "local-ssl-proxy --source 8788 --target 8787",
"start-miniflare": "miniflare --live-reload",
"start": "react-scripts start",
"start-https": "HTTPS=true yarn start",
"build:frontend": "react-scripts build",
"start:be": "yarn wrangler dev",
"start:fe": "cd ./frontend && yarn start",
"build:fe": "cd ./frontend && react-scripts build",
"lint": "eslint --ext .jsx .",
"lint:fix": "eslint --fix --ext .jsx .",
"test": "react-scripts test",
"eject": "react-scripts eject"
"lint:fix": "eslint --fix --ext .jsx ."
},
"license": "MIT",
"dependencies": {
Expand Down

0 comments on commit 63ca861

Please sign in to comment.