Commit 5cb0f192 authored by peterh-gr's avatar peterh-gr
Browse files

Made 3rd party keys dependentent on LEKTOR_ENV

We want to use test keys for Paypal and Stripe when in dev or staging
environments, so I set things up to work based on the LEKTOR_ENV
environment variable. I wanted to make the environment variable
optional for dev environments, but I'm using the lektor-envvars plugin
and it throws an error if the environment variable doesn't exist.

Issue #45066
parent f74f9adc
......@@ -44,9 +44,9 @@ You can click ```Edit this page``` and submit your content changes in a [Pull Re
6. Finally
To run a local continuous builder: ```$ lektor server```
To run a local continuous builder: ```$ LEKTOR_ENV=dev lektor server -f npm```
To just build the website once: ```$ lektor build -O <folder>```
To just build the website once: ```$ LEKTOR_ENV=prod lektor build -f npm -O <folder>```
#### How to develop on the website
......
[prod]
paypalClientId = AbzwWJgUgwGMvTupfvigx1yAj75jNnCj4mFGC_VbiROUi2TfVwPS9IZ5MfqLsSUnXJFSMwaSaTR4FY_A
stripePublishableKey = pk_live_ZJWMhGlkSwhrqFlHisMRAADt
[dev]
paypalClientId = AZc7yGlGGXnOjwt55x4wRGbWHo7Fdj83JAu0lqYruVWVoYa7JfQhy5F_ucy2mR6CjPmpmJwmtHONjTeB
stripePublishableKey = pk_test_80ln4cUc48gRoPbB1SRPeSJr
This diff is collapsed.
<div id="monthly-giving-form">
<div id="loading-dialog"></div>
<script type="text/javascript" src="https://js.stripe.com/v3/"></script>
<script type="text/javascript" src="https://www.paypal.com/sdk/js?client-id={{ bag('donate', 'paypalClientId') }}&vault=true"></script>
<script type="text/javascript" src="https://www.paypal.com/sdk/js?client-id={{ bag('donate', envvars('ENV'), 'paypalClientId') }}&vault=true"></script>
<script type="text/javascript">
window.reactComponents = [
{
......@@ -13,7 +13,7 @@
id: 'monthly-giving-form',
name: 'MonthlyGivingForm',
props: {
stripePublishableKey: `{{ bag('donate', 'stripePublishableKey') }}`
stripePublishableKey: `{{ bag('donate', envvars('ENV'), 'stripePublishableKey') }}`
},
}
];
......
......@@ -67,3 +67,4 @@ locale = zh-CN
[packages]
lektor-npm-support = 0.1.4
lektor-envvars = 18.6.12.4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment