Skip to content

Commit

Permalink
perf(hapi): use env
Browse files Browse the repository at this point in the history
  • Loading branch information
leisterfrancisco committed Apr 7, 2022
1 parent 4e6a91f commit 2c6e21c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .env.ultratestnet
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ HAPI_REWARDS_TOKEN=UOS
HAPI_SYNC_STATS_INTERVAL=60
HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL=86400
GOOGLE_APPLICATION_CREDENTIALS=/app/google-credentials.json
HAPI_RE_CAPTCHA_PROJECT_ID=eosio-dashboard
HAPI_PUBLIC_RE_CAPTCHA_KEY=6LfiHUwfAAAAAEKanm2t2roRSPxmhP5-LPUBU_wG

#webapp
PORT=3000
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-ultra-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ jobs:
HAPI_SYNC_PRODUCER_INFO_INTERVAL: '1'
HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL: 86400
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
HAPI_RE_CAPTCHA_PROJECT_ID: 'eosio-dashboard'
HAPI_PUBLIC_RE_CAPTCHA_KEY: '6LfiHUwfAAAAAEKanm2t2roRSPxmhP5-LPUBU_wG'
HAPI_SYNC_STATS_INTERVAL: ''
HAPI_EOS_EXCHANGE_RATE_API: ''
HAPI_COINGECKO_API_TOKEN_ID: ''
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ services:
HAPI_SYNC_STATS_INTERVAL: '${HAPI_SYNC_STATS_INTERVAL}'
HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL: '${HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL}'
GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}'
HAPI_RE_CAPTCHA_PROJECT_ID: '${HAPI_RE_CAPTCHA_PROJECT_ID}'
HAPI_PUBLIC_RE_CAPTCHA_KEY: '${HAPI_PUBLIC_RE_CAPTCHA_KEY}'
hasura:
container_name: '${STAGE}-${APP_NAME}-hasura'
image: hasura/graphql-engine:v2.2.1.cli-migrations-v3
Expand Down
3 changes: 2 additions & 1 deletion hapi/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module.exports = {
eosConfig: require('./eos.config'),
hasuraConfig: require('./hasura.config'),
serverConfig: require('./server.config'),
workersConfig: require('./workers.config')
workersConfig: require('./workers.config'),
recaptchaConfig: require('./recaptcha.config')
}
4 changes: 4 additions & 0 deletions hapi/src/config/recaptcha.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
projectId: process.env.HAPI_RE_CAPTCHA_PROJECT_ID,
siteKey: process.env.HAPI_PUBLIC_RE_CAPTCHA_KEY
}
2 changes: 1 addition & 1 deletion hapi/src/services/cpu.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const worker = async () => {
usage: transaction.processed.receipt.cpu_usage_us
})
} catch (error) {
console.error('cpuService.sync', error)
// console.error('cpuService.sync', error)
}
}

Expand Down
6 changes: 4 additions & 2 deletions hapi/src/utils/google-recaptcha-enterprise.util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { recaptchaConfig } = require('../config')

const {
RecaptchaEnterpriseServiceClient
} = require('@google-cloud/recaptcha-enterprise')
Expand All @@ -6,11 +8,11 @@ const isRecaptchaTokenValid = async token => {
const reCaptchaClient = new RecaptchaEnterpriseServiceClient()

const [assessment] = await reCaptchaClient.createAssessment({
parent: reCaptchaClient.projectPath('eosio-dashboard'),
parent: reCaptchaClient.projectPath(recaptchaConfig.projectId),
assessment: {
event: {
token: token,
siteKey: '6LfiHUwfAAAAAEKanm2t2roRSPxmhP5-LPUBU_wG'
siteKey: recaptchaConfig.siteKey
}
}
})
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/configmap-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ data:
HAPI_SYNC_STATS_INTERVAL: '${HAPI_SYNC_STATS_INTERVAL}'
HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL: '${HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL}'
GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}'
HAPI_RE_CAPTCHA_PROJECT_ID: '${HAPI_RE_CAPTCHA_PROJECT_ID}'
HAPI_PUBLIC_RE_CAPTCHA_KEY: '${HAPI_PUBLIC_RE_CAPTCHA_KEY}'
HAPI_EOS_EXCHANGE_RATE_API: '${HAPI_EOS_EXCHANGE_RATE_API}'
HAPI_COINGECKO_API_TOKEN_ID: '${HAPI_COINGECKO_API_TOKEN_ID}'
HAPI_REWARDS_TOKEN: '${HAPI_REWARDS_TOKEN}'
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/routes/Faucet.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Faucet = ({ ual }) => {
}
})
} catch (err) {
console.log('ERR-TRANSFER', err)
console.log('ERR', err)
}
}

Expand Down

0 comments on commit 2c6e21c

Please sign in to comment.