Skip to content

Commit f83be95

Browse files
committed
Move publishableKey check from initializer to service configure method
1 parent 5810be1 commit f83be95

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

addon/services/stripev3.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export default Service.extend({
6262
if (!didConfigure) {
6363
let publishableKey = this.get('publishableKey');
6464

65+
if (!publishableKey) {
66+
throw new Error("stripev3: Missing Stripe key, please set `ENV.stripe.publishableKey` in config.environment.js");
67+
}
6568

6669
let stripe = new Stripe(publishableKey);
6770
let functions = getProperties(stripe, STRIPE_FUNCTIONS);

app/initializers/ember-stripe-elements.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import EmberError from '@ember/error';
21
import config from '../config/environment';
32
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
43

@@ -9,10 +8,6 @@ export function initialize() {
98
application.register('config:stripe', stripeConfig, { instantiate: false });
109
application.inject('service:stripev3', 'config', 'config:stripe');
1110

12-
if (!stripeConfig.publishableKey) {
13-
throw new EmberError("stripev3: Missing Stripe key, please set `ENV.stripe.publishableKey` in config.environment.js");
14-
}
15-
1611
if (typeof FastBoot !== 'undefined' || stripeConfig.mock) {
1712
window.Stripe = StripeMock;
1813
}

0 commit comments

Comments
 (0)