diff --git a/backend/.env.example b/backend/.env.example index dff41cff..8fc31e09 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -27,3 +27,7 @@ BLOCKCHAIN_API_SECRET="ef0b48e41f78d3ae85b1379b386f1bca" # run `flask gen-admin-auth` to create new password for admin ADMIN_PASS_HASH=18f97883b93a975deb9e29257a341a447302040da59cdc2d10ff65a5e57cc197 + +# Blockchain explorer to link to. Top for mainnet, bottom for testnet. +# EXPLORER_URL="https://explorer.zcha.in/" +EXPLORER_URL="https://testnet.zcha.in/" diff --git a/backend/grant/proposal/views.py b/backend/grant/proposal/views.py index bc70f3f2..0cdeeed1 100644 --- a/backend/grant/proposal/views.py +++ b/backend/grant/proposal/views.py @@ -9,6 +9,7 @@ from grant.utils.auth import requires_auth, requires_team_member_auth, get_authe from grant.utils.exceptions import ValidationException from grant.utils.misc import is_email, make_url, from_zat, make_preview from sqlalchemy import or_ +from grant.settings import EXPLORER_URL from .models import ( Proposal, @@ -454,7 +455,7 @@ def post_contribution_confirmation(contribution_id, to, amount, txid): send_email(contribution.user.email_address, 'contribution_confirmed', { 'contribution': contribution, 'proposal': contribution.proposal, - 'tx_explorer_url': f'https://explorer.zcha.in/transactions/{txid}', + 'tx_explorer_url': f'{EXPLORER_URL}transactions/{txid}', }) # Send to the full proposal gang diff --git a/backend/grant/settings.py b/backend/grant/settings.py index 0447646a..b515b703 100644 --- a/backend/grant/settings.py +++ b/backend/grant/settings.py @@ -52,6 +52,8 @@ BLOCKCHAIN_API_SECRET = env.str("BLOCKCHAIN_API_SECRET") ADMIN_PASS_HASH = env.str("ADMIN_PASS_HASH") +EXPLORER_URL = env.str("EXPLORER_URL", default="https://explorer.zcha.in/") + UI = { 'NAME': 'ZF Grants', 'PRIMARY': '#CF8A00', diff --git a/frontend/.env.example b/frontend/.env.example index 4ac16085..eb4528ba 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -11,3 +11,7 @@ BACKEND_URL=http://localhost:5000 # sentry # SENTRY_DSN=https://PUBLICKEY@sentry.io/PROJECTID # SENTRY_RELEASE="optional, provides sentry logging with release info" + +# Blockchain explorer to link to. Top for mainnet, bottom for testnet. +# EXPLORER_URL="https://explorer.zcha.in/" +EXPLORER_URL="https://testnet.zcha.in/" diff --git a/frontend/client/utils/formatters.ts b/frontend/client/utils/formatters.ts index b0d61ca4..e45ff6d0 100644 --- a/frontend/client/utils/formatters.ts +++ b/frontend/client/utils/formatters.ts @@ -87,5 +87,5 @@ export function formatZcashCLI(address: string, amount?: string | number, memo?: } export function formatTxExplorerUrl(txid: string) { - return `https://explorer.zcha.in/transactions/${txid}`; + return `${process.env.EXPLORER_URL}transactions/${txid}`; } diff --git a/frontend/config/env.js b/frontend/config/env.js index 7e339d08..e9f1adce 100644 --- a/frontend/config/env.js +++ b/frontend/config/env.js @@ -41,14 +41,6 @@ envProductionRequiredHandler( 'http://localhost:' + (process.env.PORT || 3000), ); -if (!process.env.SENTRY_RELEASE) { - process.env.SENTRY_RELEASE = undefined; -} - -if (!process.env.BACKEND_URL) { - process.env.BACKEND_URL = 'http://localhost:5000'; -} - const appDirectory = fs.realpathSync(process.cwd()); process.env.NODE_PATH = (process.env.NODE_PATH || '') .split(path.delimiter) @@ -58,12 +50,13 @@ process.env.NODE_PATH = (process.env.NODE_PATH || '') module.exports = () => { const raw = { - BACKEND_URL: process.env.BACKEND_URL, + BACKEND_URL: process.env.BACKEND_URL || 'http://localhost:5000', + EXPLORER_URL: process.env.EXPLORER_URL || 'https://chain.so/zcash/', NODE_ENV: process.env.NODE_ENV || 'development', PORT: process.env.PORT || 3000, PUBLIC_HOST_URL: process.env.PUBLIC_HOST_URL, SENTRY_DSN: process.env.SENTRY_DSN || null, - SENTRY_RELEASE: process.env.SENTRY_RELEASE, + SENTRY_RELEASE: process.env.SENTRY_RELEASE || undefined, }; // Stringify all values so we can feed into Webpack DefinePlugin