|
13 | 13 |
|
14 | 14 | 'use strict'; |
15 | 15 |
|
16 | | -var config = module.exports = { |
17 | | - port: process.env.PORT || 8080, |
18 | | - |
19 | | - // dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to |
20 | | - // configure the appropriate settings for each storage engine below. |
21 | | - // If you are unsure, use datastore as it requires no additional |
22 | | - // configuration. |
23 | | - dataBackend: 'datastore', |
24 | | - |
25 | | - // This is the id of your project in the Google Developers Console. |
26 | | - gcloud: { |
27 | | - projectId: process.env.GCLOUD_PROJECT || 'your-project-id' |
28 | | - }, |
29 | | - |
30 | | - mysql: { |
31 | | - user: process.env.MYSQL_USER || 'your-mysql-user', |
32 | | - password: process.env.MYSQL_PASSWORD || 'your-mysql-password', |
33 | | - host: process.env.MYSQL_HOST || 'your-mysql-host' |
34 | | - }, |
35 | | - |
36 | | - mongodb: { |
37 | | - url: process.env.MONGO_URL || 'mongodb://localhost:27017', |
38 | | - collection: process.env.MONGO_COLLECTION || 'books' |
39 | | - } |
| 16 | +var getConfig = module.exports = function () { |
| 17 | + return { |
| 18 | + port: process.env.PORT || 8080, |
| 19 | + |
| 20 | + // dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to |
| 21 | + // configure the appropriate settings for each storage engine below. |
| 22 | + // If you are unsure, use datastore as it requires no additional |
| 23 | + // configuration. |
| 24 | + dataBackend: process.env.BACKEND || 'datastore', |
| 25 | + |
| 26 | + // This is the id of your project in the Google Developers Console. |
| 27 | + gcloud: { |
| 28 | + projectId: process.env.GCLOUD_PROJECT || 'your-project-id' |
| 29 | + }, |
| 30 | + |
| 31 | + mysql: { |
| 32 | + user: process.env.MYSQL_USER || 'your-mysql-user', |
| 33 | + password: process.env.MYSQL_PASSWORD || 'your-mysql-password', |
| 34 | + host: process.env.MYSQL_HOST || 'your-mysql-host' |
| 35 | + }, |
| 36 | + |
| 37 | + mongodb: { |
| 38 | + url: process.env.MONGO_URL || 'mongodb://localhost:27017', |
| 39 | + collection: process.env.MONGO_COLLECTION || 'books' |
| 40 | + } |
| 41 | + }; |
40 | 42 | }; |
41 | 43 |
|
| 44 | +var config = getConfig(); |
42 | 45 | var projectId = config.gcloud.projectId; |
43 | 46 |
|
44 | 47 | if (!projectId || projectId === 'your-project-id') { |
|
0 commit comments