File tree Expand file tree Collapse file tree 8 files changed +129
-8
lines changed
Expand file tree Collapse file tree 8 files changed +129
-8
lines changed Original file line number Diff line number Diff line change 3030 - 7-gce/node_modules/
3131
3232env :
33- - PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/test/encrypted/nodejs-docs-samples.json TEST_BUCKET_NAME =nodejs-docs-samples GCLOUD_PROJECT=nodejs-docs-samples # Other environment variables on same line
33+ - PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/test/encrypted/nodejs-docs-samples.json CLOUD_BUCKET =nodejs-docs-samples GCLOUD_PROJECT=nodejs-docs-samples OAUTH_CLIENT_ID=test-id OAUTH_CLIENT_SECRET=test-secret #Other environment variables on same line
3434
3535before_install :
3636 - if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
Original file line number Diff line number Diff line change 1313
1414'use strict' ;
1515
16- module . exports = {
16+ var config = module . exports = {
1717 port : process . env . PORT || 8080 ,
1818
1919 // dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
@@ -38,3 +38,10 @@ module.exports = {
3838 collection : process . env . MONGO_COLLECTION || 'books'
3939 }
4040} ;
41+
42+ var projectId = config . gcloud . projectId ;
43+
44+ if ( ! projectId || projectId === 'your-project-id' ) {
45+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
46+ 'project id to config.js!' ) ;
47+ }
Original file line number Diff line number Diff line change 1313
1414'use strict' ;
1515
16-
17- module . exports = {
16+ var config = module . exports = {
1817 port : process . env . PORT || 8080 ,
1918
2019 // dataBackend can be 'datastore', 'cloudsql', or 'mongodb'. Be sure to
@@ -42,3 +41,16 @@ module.exports = {
4241 collection : process . env . MONGO_COLLECTION || 'books'
4342 }
4443} ;
44+
45+ var projectId = config . gcloud . projectId ;
46+ var cloudStorageBucket = config . cloudStorageBucket ;
47+
48+ if ( ! projectId || projectId === 'your-project-id' ) {
49+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
50+ 'project id to config.js!' ) ;
51+ }
52+
53+ if ( ! cloudStorageBucket || cloudStorageBucket === 'your-bucket-name' ) {
54+ throw new Error ( 'You must set the CLOUD_BUCKET env var or add your ' +
55+ 'bucket name to config.js!' ) ;
56+ }
Original file line number Diff line number Diff line change 1414'use strict' ;
1515
1616
17- module . exports = {
17+ var config = module . exports = {
1818 port : process . env . PORT || 8080 ,
1919
2020 // Secret is used by sessions to encrypt the cookie.
@@ -55,3 +55,28 @@ module.exports = {
5555 scopes : [ 'email' , 'profile' ]
5656 }
5757} ;
58+
59+ var projectId = config . gcloud . projectId ;
60+ var cloudStorageBucket = config . cloudStorageBucket ;
61+ var clientId = config . oauth2 . clientId ;
62+ var clientSecret = config . oauth2 . clientSecret ;
63+
64+ if ( ! projectId || projectId === 'your-project-id' ) {
65+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
66+ 'project id to config.js!' ) ;
67+ }
68+
69+ if ( ! cloudStorageBucket || cloudStorageBucket === 'your-bucket-name' ) {
70+ throw new Error ( 'You must set the CLOUD_BUCKET env var or add your ' +
71+ 'bucket name to config.js!' ) ;
72+ }
73+
74+ if ( ! clientId || clientId === 'your-client-id' ) {
75+ throw new Error ( 'You must set the OAUTH_CLIENT_ID env var or add your ' +
76+ 'client id to config.js!' ) ;
77+ }
78+
79+ if ( ! clientSecret || clientSecret === 'your-client-secret' ) {
80+ throw new Error ( 'You must set the OAUTH_CLIENT_SECRET env var or add your ' +
81+ 'client secret config.js!' ) ;
82+ }
Original file line number Diff line number Diff line change 1414'use strict' ;
1515
1616
17- module . exports = {
17+ var config = module . exports = {
1818 port : process . env . PORT || 8080 ,
1919
2020 // Secret is used by sessions to encrypt the cookie.
@@ -55,3 +55,28 @@ module.exports = {
5555 scopes : [ 'email' , 'profile' ]
5656 }
5757} ;
58+
59+ var projectId = config . gcloud . projectId ;
60+ var cloudStorageBucket = config . cloudStorageBucket ;
61+ var clientId = config . oauth2 . clientId ;
62+ var clientSecret = config . oauth2 . clientSecret ;
63+
64+ if ( ! projectId || projectId === 'your-project-id' ) {
65+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
66+ 'project id to config.js!' ) ;
67+ }
68+
69+ if ( ! cloudStorageBucket || cloudStorageBucket === 'your-bucket-name' ) {
70+ throw new Error ( 'You must set the CLOUD_BUCKET env var or add your ' +
71+ 'bucket name to config.js!' ) ;
72+ }
73+
74+ if ( ! clientId || clientId === 'your-client-id' ) {
75+ throw new Error ( 'You must set the OAUTH_CLIENT_ID env var or add your ' +
76+ 'client id to config.js!' ) ;
77+ }
78+
79+ if ( ! clientSecret || clientSecret === 'your-client-secret' ) {
80+ throw new Error ( 'You must set the OAUTH_CLIENT_SECRET env var or add your ' +
81+ 'client secret config.js!' ) ;
82+ }
Original file line number Diff line number Diff line change 1414'use strict' ;
1515
1616
17- module . exports = {
17+ var config = module . exports = {
1818 port : process . env . PORT || 8080 ,
1919
2020 // Secret is used by sessions to encrypt the cookie.
@@ -55,3 +55,28 @@ module.exports = {
5555 scopes : [ 'email' , 'profile' ]
5656 }
5757} ;
58+
59+ var projectId = config . gcloud . projectId ;
60+ var cloudStorageBucket = config . cloudStorageBucket ;
61+ var clientId = config . oauth2 . clientId ;
62+ var clientSecret = config . oauth2 . clientSecret ;
63+
64+ if ( ! projectId || projectId === 'your-project-id' ) {
65+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
66+ 'project id to config.js!' ) ;
67+ }
68+
69+ if ( ! cloudStorageBucket || cloudStorageBucket === 'your-bucket-name' ) {
70+ throw new Error ( 'You must set the CLOUD_BUCKET env var or add your ' +
71+ 'bucket name to config.js!' ) ;
72+ }
73+
74+ if ( ! clientId || clientId === 'your-client-id' ) {
75+ throw new Error ( 'You must set the OAUTH_CLIENT_ID env var or add your ' +
76+ 'client id to config.js!' ) ;
77+ }
78+
79+ if ( ! clientSecret || clientSecret === 'your-client-secret' ) {
80+ throw new Error ( 'You must set the OAUTH_CLIENT_SECRET env var or add your ' +
81+ 'client secret config.js!' ) ;
82+ }
Original file line number Diff line number Diff line change 1414'use strict' ;
1515
1616
17- module . exports = {
17+ var config = module . exports = {
1818 port : process . env . PORT || 8080 ,
1919
2020 // Secret is used by sessions to encrypt the cookie.
@@ -55,3 +55,28 @@ module.exports = {
5555 scopes : [ 'email' , 'profile' ]
5656 }
5757} ;
58+
59+ var projectId = config . gcloud . projectId ;
60+ var cloudStorageBucket = config . cloudStorageBucket ;
61+ var clientId = config . oauth2 . clientId ;
62+ var clientSecret = config . oauth2 . clientSecret ;
63+
64+ if ( ! projectId || projectId === 'your-project-id' ) {
65+ throw new Error ( 'You must set the GCLOUD_PROJECT env var or add your ' +
66+ 'project id to config.js!' ) ;
67+ }
68+
69+ if ( ! cloudStorageBucket || cloudStorageBucket === 'your-bucket-name' ) {
70+ throw new Error ( 'You must set the CLOUD_BUCKET env var or add your ' +
71+ 'bucket name to config.js!' ) ;
72+ }
73+
74+ if ( ! clientId || clientId === 'your-client-id' ) {
75+ throw new Error ( 'You must set the OAUTH_CLIENT_ID env var or add your ' +
76+ 'client id to config.js!' ) ;
77+ }
78+
79+ if ( ! clientSecret || clientSecret === 'your-client-secret' ) {
80+ throw new Error ( 'You must set the OAUTH_CLIENT_SECRET env var or add your ' +
81+ 'client secret config.js!' ) ;
82+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ Tutorial | Folder
2727
2828* Make sure you're authenticated with the gcloud sdk and your gcloud project
2929has enabled all the APIs used by these tutorials.
30+ * Make sure you've got the required environment variables set. (Take a look at
31+ the various config.js files.)
3032* ` git clone git@github.com:GoogleCloudPlatform/nodejs-getting-started.git `
3133* ` cd nodejs-getting-started `
3234* ` npm install `
You can’t perform that action at this time.
0 commit comments