Skip to content

Commit

Permalink
build: pangea deploy (#2657)
Browse files Browse the repository at this point in the history
* fix: forcing settings to be present

* fix: enviromnent variables for graphQL namespaces

* fix: delete unneded file

* fix: remove auto-generated readme

* fix: optional captcha controlled by ENABLE_CAPTCHA env variable
  • Loading branch information
n13 authored Sep 29, 2024
1 parent 100cc00 commit 9f98cb8
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO - Test'
CHAIN_NAME: 'telos'
ENV: 'dev'
IS_TESTNET: 'true'
NETWORK_CHAIN_ID: '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
DAO_CONTRACT: 'mtdhoxhyphaa'
HYPHA_CONTRACT: 'mtrwardhypha'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-eos-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO - EOS TestNet'
CHAIN_NAME: 'eos'
ENV: 'dev'
IS_TESTNET: 'true'
NETWORK_CHAIN_ID: ${{ vars.NETWORK_CHAIN_ID }}
DAO_CONTRACT: 'daoxhypha111'
HYPHA_CONTRACT: 'hyphaxhypha1'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy-eos-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO - EOS'
CHAIN_NAME: 'eos'
ENV: 'prod'
IS_TESTNET: 'false'
NETWORK_CHAIN_ID: ${{ vars.NETWORK_CHAIN_ID }}
DAO_CONTRACT: 'dao.hypha'
HYPHA_CONTRACT: 'hypha.hypha'
SUPPLY_CONTRACT: 'voice.hypha'
MULTISIG_CONTRACT: 'msig.hypha'
KV_CONTRACT: 'kv.hypha'
PPP_ENV: ${{ vars.PPP_ENV }}
ENV: 'prod'
HYPHA_AUTH_URL: ${{ vars.HYPHA_AUTH_URL }}
PPP_APP_ID: ${{ vars.PPP_APP_ID }}
ACCOUNT_API_URL: ${{ vars.ACCOUNT_API_URL }}
Expand All @@ -49,7 +51,6 @@ jobs:
BLOCKCHAIN_EXPLORER_BTC: 'https://www.blockchain.com/btc/tx/'
BLOCKCHAIN_EXPLORER_ETH: 'https://etherscan.io/tx/'
BLOCKCHAIN_EXPLORER_EOS: 'https://bloks.io/transaction/'
CHAIN_NAME: 'eos'
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
DOCUMENTATION: ${{ vars.DOCUMENTATION }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy-eos-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO - EOS'
CHAIN_NAME: 'eos'
ENV: 'stage'
IS_TESTNET: 'false'
NETWORK_CHAIN_ID: ${{ vars.NETWORK_CHAIN_ID }}
DAO_CONTRACT: 'dao.hypha'
HYPHA_CONTRACT: 'hypha.hypha'
SUPPLY_CONTRACT: 'voice.hypha'
MULTISIG_CONTRACT: 'msig.hypha'
KV_CONTRACT: 'kv.hypha'
PPP_ENV: ${{ vars.PPP_ENV }}
ENV: 'prod'
HYPHA_AUTH_URL: ${{ vars.HYPHA_AUTH_URL }}
PPP_APP_ID: ${{ vars.PPP_APP_ID }}
ACCOUNT_API_URL: ${{ vars.ACCOUNT_API_URL }}
Expand All @@ -47,7 +49,6 @@ jobs:
BLOCKCHAIN_EXPLORER_BTC: 'https://www.blockchain.com/btc/tx/'
BLOCKCHAIN_EXPLORER_ETH: 'https://etherscan.io/tx/'
BLOCKCHAIN_EXPLORER_EOS: 'https://bloks.io/transaction/'
CHAIN_NAME: 'eos'
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
DOCUMENTATION: ${{ vars.DOCUMENTATION }}

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO'
CHAIN_NAME: 'telos'
ENV: 'prod'
IS_TESTNET: 'false'
NETWORK_CHAIN_ID: '4667b205c6838ef70ff7988f6e8257e8be0e1284a2f59699054a018f743b1d11'
DAO_CONTRACT: 'dao.hypha'
HYPHA_CONTRACT: 'hypha.hypha'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ jobs:
- run: yarn build
env:
APP_NAME: 'Hypha DHO Staging'
CHAIN_NAME: 'telos'
ENV: 'stage' ## was 'prod'
IS_TESTNET: 'false'
NETWORK_CHAIN_ID: '4667b205c6838ef70ff7988f6e8257e8be0e1284a2f59699054a018f743b1d11'
DAO_CONTRACT: 'dao.hypha'
HYPHA_CONTRACT: 'hypha.hypha'
KV_CONTRACT: 'kv.hypha'
ENV: 'prod'
HYPHA_AUTH_URL: ${{ vars.HYPHA_AUTH_URL }}
DECIDE_CONTRACT: 'trailservice'
SEEDS_TOKEN_CONTRACT: 'token.seeds'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"scripts": {
"dev": "quasar dev -m spa",
"dev:eos": "env-cmd -f ./config/eos-testnet.env quasar dev -m spa",
"dev:pangea": "env-cmd -f ./config/pangea-testnet.env quasar dev -m spa",
"prod:telos": "env-cmd -f ./config/telos-mainnet.env quasar dev -m spa",
"prod:eos": "env-cmd -f ./config/eos-mainnet.env quasar dev -m spa",
"build": "NODE_OPTIONS=--openssl-legacy-provider quasar build",
Expand Down
2 changes: 2 additions & 0 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = function (ctx) {
build: {
env: {
APP_NAME: process.env.APP_NAME,
ENV: process.env.ENV,
DGRAPH_URL: process.env.DGRAPH_URL,
DGRAPH_ROOT_HASH: process.env.DGRAPH_ROOT_HASH,
DGRAPH_AUTH_KEY: process.env.DGRAPH_AUTH_KEY,
Expand Down Expand Up @@ -111,6 +112,7 @@ module.exports = function (ctx) {
CAPTCHA_PUBLIC_KEY: process.env.CAPTCHA_PUBLIC_KEY,
CAPTCHA_HOST: process.env.CAPTCHA_HOST,
CAPTCHA_NETWORK: process.env.CAPTCHA_NETWORK || 'telosTestnet',
ENABLE_CAPTCHA: process.env.ENABLE_CAPTCHA !== undefined ? process.env.ENABLE_CAPTCHA === 'true' : true,
LOGIN_CONTRACT: process.env.LOGIN_CONTRACT,
JOIN_CONTRACT: process.env.JOIN_CONTRACT,
JOIN_URI: process.env.JOIN_URI,
Expand Down
23 changes: 17 additions & 6 deletions src/apollo/apollo-client-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ const tokenRefreshLink = new TokenRefreshLink({
}
},
fetchAccessToken: () => {
const HYPHA_AUTH_URL = process.env.HYPHA_AUTH_URL
const CHAIN_NAME = process.env.CHAIN_NAME
const ENV = process.env.ENV || 'dev'
const network = process.env.IS_TESTNET ? 'testnet' : 'mainnet'
const url = `${HYPHA_AUTH_URL}?chain=${CHAIN_NAME}&env=${ENV}&network=${network}`

const hyphaAuthUrl = process.env.HYPHA_AUTH_URL
const chainName = process.env.CHAIN_NAME
const env = process.env.ENV
const network = process.env.IS_TESTNET === 'true' ? 'testnet' : 'mainnet'
if (!process.env.HYPHA_AUTH_URL) {
throw Error('process.env.HYPHA_AUTH_URL not defined')
}
if (!process.env.CHAIN_NAME) {
throw Error('process.env.CHAIN_NAME not defined (eos, telos, pangea)')
}
if (!process.env.ENV) {
throw Error('process.env.ENV not defined (dev or prod or stage)')
}
if (!process.env.IS_TESTNET) {
throw Error('process.env.IS_TESTNET needs to be set (true or false)')
}
const url = `${hyphaAuthUrl}?chain=${chainName}&env=${env}&network=${network}`
return fetch(url, {
method: 'GET'
})
Expand Down
13 changes: 9 additions & 4 deletions src/components/form/captcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ export default {
data() {
const sitekey = process.env.CAPTCHA_PUBLIC_KEY
return {
sitekey
sitekey,
enableCaptcha: process.env.ENABLE_CAPTCHA
}
},
methods: {
verifyChallenge(response) {
CaptchaService.verifyChallenge({ token: response, network: process.env.CAPTCHA_NETWORK }).then((response) => {
this.$emit('setCaptchaResponse', response)
})
if (this.enableCaptcha) {
CaptchaService.verifyChallenge({ token: response, network: process.env.CAPTCHA_NETWORK }).then((response) => {
this.$emit('setCaptchaResponse', response)
})
} else {
this.$emit('setCaptchaResponse', { success: true })
}
}
}
}
Expand Down
48 changes: 24 additions & 24 deletions src/pages/dho/Configuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
SettingsVoting: () => import('~/components/dao/settings-voting.vue')
},
data () {
data() {
return {
CONFIGURATION_STATE,
TABS,
Expand All @@ -125,7 +125,7 @@ export default {
'executeSettingsMultisig'
]),
initForm () {
initForm() {
this.initialForm = {
// General
logo: this.daoSettings?.logo ? this.daoSettings?.logo : defaultSettings.logo,
Expand Down Expand Up @@ -173,13 +173,13 @@ export default {
this.resetForm()
},
resetForm () {
resetForm() {
this.form = {
...this.initialForm
}
},
async createMultisig () {
async createMultisig() {
try {
this.state = CONFIGURATION_STATE.CREATE_MULTI_SIG
Expand All @@ -196,7 +196,7 @@ export default {
}
},
async cancelMultisig () {
async cancelMultisig() {
try {
this.state = CONFIGURATION_STATE.SAVING
await this.cancelSettingsMultisig({ id: this.activeMultisig.id })
Expand All @@ -207,7 +207,7 @@ export default {
}
},
async voteMultisig (approve) {
async voteMultisig(approve) {
try {
this.state = CONFIGURATION_STATE.SAVING
await this.voteSettingsMultisig({ id: this.activeMultisig.id, approve })
Expand All @@ -218,7 +218,7 @@ export default {
}
},
async executeMultisig () {
async executeMultisig() {
try {
this.state = CONFIGURATION_STATE.SAVING
await this.executeSettingsMultisig({ id: this.activeMultisig.id })
Expand All @@ -229,7 +229,7 @@ export default {
}
},
async resetMultisig () {
async resetMultisig() {
try {
this.state = CONFIGURATION_STATE.SAVING
this.resetForm()
Expand All @@ -240,7 +240,7 @@ export default {
}
},
async updateSettings () {
async updateSettings() {
try {
this.state = CONFIGURATION_STATE.SAVING
await this.updateDAOSettings({ data: { ...this.dataForSave } })
Expand All @@ -263,7 +263,7 @@ export default {
}
},
async importElection () {
async importElection() {
try {
this.state = CONFIGURATION_STATE.SAVING
await this.importEdenElection(this.selectedDao.docId)
Expand All @@ -274,16 +274,16 @@ export default {
}
},
onChange (name, value) { this.$set(this.form, name, value) },
onChange(name, value) { this.$set(this.form, name, value) },
onLeavePageConfirmed (answer) {
onLeavePageConfirmed(answer) {
this.state = CONFIGURATION_STATE.LEFT
if (answer) {
this.next()
}
},
async onSave () {
async onSave() {
if (this.daoSettings.multisigEnabled) {
this.state = CONFIGURATION_STATE.CREATE_MULTI_SIG
} else {
Expand All @@ -297,30 +297,30 @@ export default {
...mapGetters('accounts', ['account', 'isAdmin']),
...mapGetters('dao', ['daoAlerts', 'daoAnnouncements', 'daoSettings', 'daoSettingsMultisigs', 'isHypha', 'selectedDao', 'selectedDaoPlan']),
activeMultisig () { return this.daoSettingsMultisigs ? this.daoSettingsMultisigs[0] : {} },
hasActiveMultisig () { return this.daoSettingsMultisigs.length > 0 },
hasSignedMultisig () { return this.activeMultisig ? !!this.activeMultisig?.approvedby?.find(_ => _.details_member_n === this.account) : false },
isMultisigModalOpen () {
activeMultisig() { return this.daoSettingsMultisigs ? this.daoSettingsMultisigs[0] : {} },
hasActiveMultisig() { return this.daoSettingsMultisigs.length > 0 },
hasSignedMultisig() { return this.activeMultisig ? !!this.activeMultisig?.approvedby?.find(_ => _.details_member_n === this.account) : false },
isMultisigModalOpen() {
return [
CONFIGURATION_STATE.CREATE_MULTI_SIG,
CONFIGURATION_STATE.SIGN_MULTI_SIG,
CONFIGURATION_STATE.VIEW_MULTI_SIG
].includes(this.state)
},
multiSigState () {
multiSigState() {
if (this.state === CONFIGURATION_STATE.CREATE_MULTI_SIG) return 'CREATE'
if (this.state === CONFIGURATION_STATE.SIGN_MULTI_SIG) return 'SIGN'
if (this.state === CONFIGURATION_STATE.VIEW_MULTI_SIG) return 'VIEW'
return 'VIEW'
},
isLeaving () { return this.state === CONFIGURATION_STATE.LEAVING },
isLeaving() { return this.state === CONFIGURATION_STATE.LEAVING },
dataForSave () { return settingsMapper(this.changedFields.reduce((acc, field) => ({ ...acc, [field]: this.form[field] }), {})) },
dataForSave() { return settingsMapper(this.changedFields.reduce((acc, field) => ({ ...acc, [field]: this.form[field] }), {})) },
changedFields () {
changedFields() {
const changed = []
Object.keys(this.form).forEach(field => {
const inital = this.initialForm[field]
Expand Down Expand Up @@ -351,14 +351,14 @@ export default {
return changed
},
numberOfChanges () { return this.changedFields.length }
numberOfChanges() { return this.changedFields.length }
},
async mounted () {
async mounted() {
this.initForm()
},
async beforeRouteLeave (to, from, next) {
async beforeRouteLeave(to, from, next) {
this.next = next
if (this.numberOfChanges > 0) {
Expand Down

0 comments on commit 9f98cb8

Please sign in to comment.