|
1 | 1 | // Global config that respects the node environment |
2 | 2 | const functions = require('firebase-functions'); |
3 | 3 |
|
4 | | -const {NODE_ENV, PORT = 3000} = process.env |
| 4 | +const {NODE_ENV, |
| 5 | + PORT = 3000} = process.env |
5 | 6 |
|
6 | | -// The URL of this application |
7 | | -let apiURL = `http://localhost:${PORT}` |
| 7 | +let apiURL, // URL of this application |
| 8 | + databaseURL, // Firebase database URL |
| 9 | + stripePrivateKey, |
| 10 | + stripePublicKey; |
8 | 11 |
|
9 | | -// The Firebase database URL |
10 | | -let databaseURL = 'https://radio4000-staging.firebaseio.com/' |
| 12 | +// CDN URL to the radio4000-player script |
| 13 | +const playerScriptURL = 'https://unpkg.com/radio4000-player'; |
11 | 14 |
|
12 | | -// The CDN URL to the radio4000-player script |
13 | | -const playerScriptURL = 'https://unpkg.com/radio4000-player' |
14 | | - |
15 | | -// stripe |
16 | | -let stripeSecretKey = functions.config().stripe.secret_key; |
17 | | -let stripePublicKey = functions.config().stripe.public_key; |
| 15 | +apiURL = `http://localhost:${PORT}`; |
| 16 | +databaseURL = 'https://radio4000-staging.firebaseio.com/'; |
| 17 | +stripePrivateKey = functions.config().stripe.private_key; |
| 18 | +stripePublicKey = functions.config().stripe.public_key; |
18 | 19 |
|
19 | 20 | if (NODE_ENV === 'production') { |
20 | | - apiURL = `https://api.radio4000.com` |
21 | | - databaseURL = 'https://radio4000.firebaseio.com/' |
22 | | - stripeSecretKey = functions.config().stripe_production.secret_key; |
23 | | - stripePublicKey = functions.config().stripe_production.public_key; |
| 21 | + apiURL = 'https://api.radio4000.com'; |
| 22 | + databaseURL = 'https://radio4000.firebaseio.com/'; |
| 23 | + stripePrivateKey = functions.config().stripe.production_private_key; |
| 24 | + stripePublicKey = functions.config().stripe.production_public_key; |
24 | 25 | } |
25 | 26 |
|
26 | 27 | module.exports = { |
27 | 28 | apiURL, |
28 | 29 | databaseURL, |
29 | 30 | playerScriptURL, |
30 | 31 | port: PORT, |
31 | | - stripeSecretKey, |
| 32 | + stripePrivateKey, |
32 | 33 | stripePublicKey |
33 | 34 | } |
0 commit comments