Merge pull request #102 from grant-project/explorer-url-env-var

Environment variable for explorer URL
This commit is contained in:
Daniel Ternyak 2019-01-28 15:21:38 -06:00 committed by GitHub
commit e1d351762a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 12 deletions

View File

@ -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/"

View File

@ -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

View File

@ -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',

View File

@ -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/"

View File

@ -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}`;
}

View File

@ -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