Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#39 from GoogleCloudPlatform/co…
Browse files Browse the repository at this point in the history
…nfig

Allow config from env vars.
  • Loading branch information
jmdobry committed Feb 5, 2016
2 parents 1ce06e6 + b74b86c commit 2b9ea17
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 52 deletions.
11 changes: 5 additions & 6 deletions 2-structured-data/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

'use strict';


module.exports = {
port: process.env.PORT || 8080,

Expand All @@ -29,13 +28,13 @@ module.exports = {
},

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
}
};
12 changes: 6 additions & 6 deletions 3-binary-data/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ module.exports = {
},

// Typically, you will create a bucket with the same name as your project ID.
cloudStorageBucket: 'your-bucket-name',
cloudStorageBucket: process.env.CLOUD_BUCKET || 'your-bucket-name',

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
}
};
20 changes: 10 additions & 10 deletions 4-auth/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
port: process.env.PORT || 8080,

// Secret is used by sessions to encrypt the cookie.
secret: 'your-secret-here',
secret: process.env.SESSION_SECRET || 'your-secret-here',

// dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
// configure the appropriate settings for each storage engine below.
Expand All @@ -32,26 +32,26 @@ module.exports = {
},

// Typically, you will create a bucket with the same name as your project ID.
cloudStorageBucket: 'your-bucket-name',
cloudStorageBucket: process.env.CLOUD_BUCKET || 'your-bucket-name',

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
},

// The client ID and secret can be obtained by generating a new web
// application client ID on Google Developers Console.
oauth2: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
clientId: process.env.OAUTH_CLIENT_ID || 'your-client-id',
clientSecret: process.env.OAUTH_CLIENT_SECRET || 'your-client-secret',
redirectUrl: process.env.OAUTH2_CALLBACK ||
'http://localhost:8080/oauth2callback',
scopes: ['email', 'profile']
},
}
};
20 changes: 10 additions & 10 deletions 5-logging/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
port: process.env.PORT || 8080,

// Secret is used by sessions to encrypt the cookie.
secret: 'your-secret-here',
secret: process.env.SESSION_SECRET || 'your-secret-here',

// dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
// configure the appropriate settings for each storage engine below.
Expand All @@ -32,26 +32,26 @@ module.exports = {
},

// Typically, you will create a bucket with the same name as your project ID.
cloudStorageBucket: 'your-bucket-name',
cloudStorageBucket: process.env.CLOUD_BUCKET || 'your-bucket-name',

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
},

// The client ID and secret can be obtained by generating a new web
// application client ID on Google Developers Console.
oauth2: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
clientId: process.env.OAUTH_CLIENT_ID || 'your-client-id',
clientSecret: process.env.OAUTH_CLIENT_SECRET || 'your-client-secret',
redirectUrl: process.env.OAUTH2_CALLBACK ||
'http://localhost:8080/oauth2callback',
scopes: ['email', 'profile']
},
}
};
20 changes: 10 additions & 10 deletions 6-pubsub/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
port: process.env.PORT || 8080,

// Secret is used by sessions to encrypt the cookie.
secret: 'your-secret-here',
secret: process.env.SESSION_SECRET || 'your-secret-here',

// dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
// configure the appropriate settings for each storage engine below.
Expand All @@ -32,26 +32,26 @@ module.exports = {
},

// Typically, you will create a bucket with the same name as your project ID.
cloudStorageBucket: 'your-bucket-name',
cloudStorageBucket: process.env.CLOUD_BUCKET || 'your-bucket-name',

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
},

// The client ID and secret can be obtained by generating a new web
// application client ID on Google Developers Console.
oauth2: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
clientId: process.env.OAUTH_CLIENT_ID || 'your-client-id',
clientSecret: process.env.OAUTH_CLIENT_SECRET || 'your-client-secret',
redirectUrl: process.env.OAUTH2_CALLBACK ||
'http://localhost:8080/oauth2callback',
scopes: ['email', 'profile']
},
}
};
20 changes: 10 additions & 10 deletions 7-gce/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
port: process.env.PORT || 8080,

// Secret is used by sessions to encrypt the cookie.
secret: 'your-secret-here',
secret: process.env.SESSION_SECRET || 'your-secret-here',

// dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
// configure the appropriate settings for each storage engine below.
Expand All @@ -32,26 +32,26 @@ module.exports = {
},

// Typically, you will create a bucket with the same name as your project ID.
cloudStorageBucket: 'your-bucket-name',
cloudStorageBucket: process.env.CLOUD_BUCKET || 'your-bucket-name',

mysql: {
user: 'your-mysql-user',
password: 'your-mysql-password',
host: 'your-mysql-host'
user: process.env.MYSQL_USER || 'your-mysql-user',
password: process.env.MYSQL_PASSWORD || 'your-mysql-password',
host: process.env.MYSQL_HOST || 'your-mysql-host'
},

mongodb: {
url: 'your-mongo-url',
collection: 'your-mongo-collection'
url: process.env.MONGO_URL || 'mongodb://localhost:27017',
collection: process.env.MONGO_COLLECTION || 'books'
},

// The client ID and secret can be obtained by generating a new web
// application client ID on Google Developers Console.
oauth2: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
clientId: process.env.OAUTH_CLIENT_ID || 'your-client-id',
clientSecret: process.env.OAUTH_CLIENT_SECRET || 'your-client-secret',
redirectUrl: process.env.OAUTH2_CALLBACK ||
'http://localhost:8080/oauth2callback',
scopes: ['email', 'profile']
},
}
};

0 comments on commit 2b9ea17

Please sign in to comment.