Skip to content

Commit

Permalink
Merge pull request #352 from edenia/fix/update-delegate-verification-351
Browse files Browse the repository at this point in the history
fix(webapp): add enviroment variable
  • Loading branch information
xavier506 authored Dec 23, 2022
2 parents a499e2d + a1c776f commit c780998
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
21 changes: 11 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,34 @@ HASURA_GRAPHQL_ACTION_BASE_URL=http://hapi:9090
# hapi
HAPI_SERVER_PORT=9090
HAPI_SERVER_ADDRESS=hapi
HAPI_NETWORK_API=https://eos.api.eosnation.io
HAPI_NETWORK_CHAIN_ID=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
HAPI_NETWORK_API=https://jungle4.api.eosnation.io
HAPI_NETWORK_CHAIN_ID=73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d
HAPI_NETWORK_BASE_ACCOUNT=accountname1
HAPI_NETWORK_BASE_PASSWORD=PW...
HAPI_NETWORK_WALLET_URL=http://wallet:8888
HAPI_HASURA_URL=http://hasura:8080/v1/graphql
HAPI_HASURA_ADMIN_SECRET=myadminsecretkey
HAPI_EDEN_ELECTION_INTERVAL=7889400
HAPI_EDEN_HISTORIC_ELECTION= [{"election": 0, "date_election": "2021-10-09"}, {"election": 1, "date_election": "2022-04-09"}, {"election": 2, "date_election": "2022-07-09"}, {"election": 3, "date_election": "2022-10-08"}]
HAPI_EDEN_HISTORIC_ELECTION= [{"election": 0, "date_election": "2022-09-18"}, {"election": 1, "date_election": "2022-09-22"}, {"election": 2, "date_election": "2022-09-23T13:00:00.000"}, {"election": 3, "date_election": "2022-09-23T20:00:00.000"}, {"election": 4, "date_election": "2022-09-27"}, {"election": 5, "date_election": "2022-09-30"}]
HAPI_EDEN_CONTRACT=genesis.eden
HAPI_RATE_HISTORY=https://api.coingecko.com/api/v3
HAPI_DFUSE_API_KEY=<api_key>
HAPI_DFUSE_API=eos.dfuse.eosnation.io
HAPI_DFUSE_FIRST_BLOCK=209174091
HAPI_DFUSE_API=jungle4.dfuse.eosnation.io
HAPI_DFUSE_FIRST_BLOCK=35955488

#webapp
PORT=3000
REACT_APP_TAG=localdev
REACT_APP_NAME=local
REACT_APP_TITLE=Eden on EOS delegate spend explorer
REACT_APP_NAME=eden-spending
REACT_APP_TITLE=Eden on EOS Accounting Standard
REACT_APP_LOGO=https://raw.githubusercontent.com/eoscostarica/design-assets/master/logos/eosCR/fullColor-vertiall-transparent-white.png
REACT_APP_FOOTER_LINKS=[]
REACT_APP_UAL_APP_NAME=edenSpendingApp
REACT_APP_UAL_APP_NAME=EOS Reports
REACT_APP_UAL_API_PROTOCOL=https
REACT_APP_UAL_API_HOST=eos.greymass.com
REACT_APP_UAL_API_HOST=jungle4.api.eosnation.io
REACT_APP_UAL_API_PORT=443
REACT_APP_UAL_CHAIN_ID=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
REACT_APP_UAL_CHAIN_ID=73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d
REACT_APP_HASURA_URL=http://localhost:8080/v1/graphql
REACT_APP_RATE_HISTORY=https://api.coingecko.com/api/v3
REACT_APP_EDEN_CONTRACT=genesis.eden
REACT_APP_URL_ENDPOINT=https://eden-api-dev.edenia.cloud
5 changes: 3 additions & 2 deletions .github/workflows/push-dev-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
REACT_APP_HASURA_URL: ${{ secrets.REACT_APP_HASURA_URL }}
REACT_APP_RATE_HISTORY: ${{ secrets.REACT_APP_RATE_HISTORY }}
REACT_APP_EDEN_CONTRACT: 'genesis.eden'
REACT_APP_URL_ENDPOINT: 'https://eden-api-dev.edenia.cloud'

- name: Build kubernetes files
id: build_kubernetes_files
Expand Down Expand Up @@ -79,7 +80,7 @@ jobs:
HAPI_EDEN_ELECTION_INTERVAL: 7889400
HAPI_EDEN_HISTORIC_ELECTION: ${{secrets.HAPI_EDEN_HISTORIC_ELECTION}}
HAPI_EDEN_CONTRACT: genesis.eden
HAPI_DFUSE_API_KEY:
HAPI_DFUSE_API_KEY: ${{secrets.HAPI_DFUSE_API_KEY}}
HAPI_DFUSE_API: jungle4.dfuse.eosnation.io
HAPI_DFUSE_FIRST_BLOCK: ${{secrets.HAPI_DFUSE_FIRST_BLOCK}}
# hasura
Expand All @@ -96,4 +97,4 @@ jobs:
NAMESPACE: eden-spending
K8S_BUILD_DIR: build_k8s
with:
args: version && make deploy-kubernetes
args: version && make deploy-kubernetes
1 change: 1 addition & 0 deletions .github/workflows/push-prod-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
REACT_APP_HASURA_URL: ${{ secrets.REACT_APP_HASURA_URL }}
REACT_APP_RATE_HISTORY: ${{ secrets.REACT_APP_RATE_HISTORY }}
REACT_APP_EDEN_CONTRACT: 'genesis.eden'
REACT_APP_URL_ENDPOINT: 'https://eden-api.edenia.cloud'

- name: Build kubernetes files
id: build_kubernetes_files
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ services:
REACT_APP_HASURA_URL: '${REACT_APP_HASURA_URL}'
REACT_APP_RATE_HISTORY: '${REACT_APP_RATE_HISTORY}'
REACT_APP_EDEN_CONTRACT: '${REACT_APP_EDEN_CONTRACT}'
REACT_APP_URL_ENDPOINT: '${REACT_APP_URL_ENDPOINT}'
volumes:
postgres_data:
2 changes: 2 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG react_app_ual_chain_id
ARG react_app_hasura_url
ARG react_app_rate_history
ARG react_app_eden_contract
ARG react_app_url_endpoint

ENV REACT_APP_TAG $react_app_tag
ENV REACT_APP_NAME $react_app_name
Expand All @@ -27,6 +28,7 @@ ENV REACT_APP_UAL_CHAIN_ID $react_app_ual_chain_id
ENV REACT_APP_HASURA_URL $react_app_hasura_url
ENV REACT_APP_RATE_HISTORY $react_app_rate_history
ENV REACT_APP_EDEN_CONTRACT $react_app_eden_contract
ENV REACT_APP_URL_ENDPOINT $react_app_url_endpoint

WORKDIR /usr/src/app

Expand Down
1 change: 1 addition & 0 deletions webapp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ build-docker: ./Dockerfile
--build-arg react_app_hasura_url="$(REACT_APP_HASURA_URL)" \
--build-arg react_app_rate_history="$(REACT_APP_RATE_HISTORY)" \
--build-arg react_app_eden_contract="$(REACT_APP_EDEN_CONTRACT)" \
--build-arg react_app_url_endpoint="$(REACT_APP_URL_ENDPOINT)" \
.

pull-image: ##@devops Pull the latest image from registry for caching
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/components/Sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import PropTypes from 'prop-types'

import { useSharedState } from '../../context/state.context'
import { GET_MEMBERS_DATA } from '../../gql'
import { mainConfig } from '../../config'
import AuthButton from '../AuthButton'

import styles from './styles'
Expand All @@ -31,7 +32,7 @@ const SidebarComp = ({ routes, openComponent, onClose }) => {
const [open, setOpen] = useState(false)
const { pathname } = router
const [userData, setUSerData] = useState()
const client = new GraphQLClient('https://eden-api.edenia.cloud/v1/graphql', {
const client = new GraphQLClient(`${mainConfig.urlEndpoint}/v1/graphql`, {
headers: {}
})

Expand Down
1 change: 1 addition & 0 deletions webapp/src/config/main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const title = process.env.REACT_APP_TITLE
export const logo = process.env.REACT_APP_LOGO
export const eosRate = process.env.REACT_APP_RATE_HISTORY
export const edenContract = process.env.REACT_APP_EDEN_CONTRACT
export const urlEndpoint = process.env.REACT_APP_URL_ENDPOINT
export const footerLinks = JSON.parse(
process.env.REACT_APP_FOOTER_LINKS || '[]'
)
3 changes: 2 additions & 1 deletion webapp/src/hooks/customHooks/useDelegateReportState.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useReducer } from 'react'
import { gql, GraphQLClient } from 'graphql-request'

import { mainConfig } from '../../config'
import {
GET_ELECTIONS_BY_YEAR,
GET_MEMBERS_DATA,
Expand All @@ -27,7 +28,7 @@ const INIT_REDUCER_DATA = {
maxLevel: 0,
searchValue: ''
}
const client = new GraphQLClient('https://eden-api.edenia.cloud/v1/graphql', {
const client = new GraphQLClient(`${mainConfig.urlEndpoint}/v1/graphql`, {
headers: {}
})

Expand Down

0 comments on commit c780998

Please sign in to comment.