Skip to content

Commit 4a0ce8f

Browse files
authored
fix: remove redundant run_ tags (fixit) (#3679)
## Description Removes redundant region tags from *.js files run_end_user_firebase_config run_end_user_firebase_sign_in run_end_user_token run_helloworld_service run_secure_request run_secure_request_do run_system_package_exec run_system_package_handler run_tips_global_lazy run_tips_global_scope run_user_auth_jwt run_user_auth_sql_connect (Some tags in Dockerfiles and HTML files remain) - [x] Please **merge** this PR for me once it is approved
1 parent 76e05cc commit 4a0ce8f

File tree

11 files changed

+31
-25
lines changed

11 files changed

+31
-25
lines changed

functions/tips/lazyGlobals/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const fileWideComputation = lightComputation;
3030

3131
// [START functions_tips_lazy_globals]
3232
// [START cloudrun_tips_global_lazy]
33-
// [START run_tips_global_lazy]
3433
const functions = require('@google-cloud/functions-framework');
3534

3635
// Always initialized (at cold-start)
@@ -51,6 +50,5 @@ functions.http('lazyGlobals', (req, res) => {
5150

5251
res.send(`Lazy global: ${lazyGlobal}, non-lazy global: ${nonLazyGlobal}`);
5352
});
54-
// [END run_tips_global_lazy]
5553
// [END cloudrun_tips_global_lazy]
5654
// [END functions_tips_lazy_globals]

functions/tips/scopeDemo/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
// [START functions_tips_scopes]
1818
// [START cloudrun_tips_global_scope]
19-
// [START run_tips_global_scope]
2019
const functions = require('@google-cloud/functions-framework');
2120

2221
// TODO(developer): Define your own computations
@@ -39,6 +38,5 @@ functions.http('scopeDemo', (req, res) => {
3938

4039
res.send(`Per instance: ${instanceVar}, per function: ${functionVar}`);
4140
});
42-
// [END run_tips_global_scope]
4341
// [END cloudrun_tips_global_scope]
4442
// [END functions_tips_scopes]

functions/tips/scopeDemo/test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const restoreConsole = function () {
5757
beforeEach(stubConsole);
5858
afterEach(restoreConsole);
5959

60-
describe('functions_tips_scopes cloudrun_tips_global_scope run_tips_global_scope', () => {
60+
describe('functions_tips_scopes cloudrun_tips_global_scope', () => {
6161
const computations = sinon.spy(require('../computations'));
6262

6363
require('..');

run/helloworld/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
// [START cloudrun_helloworld_service]
16-
// [START run_helloworld_service]
1716
import express from 'express';
1817
const app = express();
1918

@@ -26,7 +25,6 @@ const port = parseInt(process.env.PORT) || 8080;
2625
app.listen(port, () => {
2726
console.log(`helloworld: listening on port ${port}`);
2827
});
29-
// [END run_helloworld_service]
3028
// [END cloudrun_helloworld_service]
3129

3230
// Exports for testing purposes.

run/idp-sql/cloud-sql.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const config = {
3434
};
3535

3636
// [START cloudrun_user_auth_sql_connect]
37-
// [START run_user_auth_sql_connect]
3837
/**
3938
* Connect to the Cloud SQL instance through UNIX Sockets
4039
*
@@ -55,7 +54,6 @@ const connectWithUnixSockets = async credConfig => {
5554
...config,
5655
});
5756
};
58-
// [END run_user_auth_sql_connect]
5957
// [END cloudrun_user_auth_sql_connect]
6058

6159
// Method to connect locally on Windows

run/idp-sql/middleware.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
const {logger} = require('./logging'); // Import winston logger instance
1616

1717
// [START cloudrun_user_auth_jwt]
18-
// [START run_user_auth_jwt]
1918
const firebase = require('firebase-admin');
2019
// Initialize Firebase Admin SDK
2120
firebase.initializeApp();
@@ -43,7 +42,6 @@ const authenticateJWT = (req, res, next) => {
4342
return res.sendStatus(401);
4443
}
4544
};
46-
// [END run_user_auth_jwt]
4745
// [END cloudrun_user_auth_jwt]
4846

4947
let project;

run/idp-sql/static/config.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
* Licensed under the Apache License, Version 2.0 (the `License`);
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an `AS IS` BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
116
// [START cloudrun_end_user_firebase_config]
2-
// [START run_end_user_firebase_config]
317
const config = {
418
apiKey: 'API_KEY',
519
authDomain: 'PROJECT_ID.firebaseapp.com',
620
};
7-
// [END run_end_user_firebase_config]
821
// [END cloudrun_end_user_firebase_config]

run/idp-sql/static/firebase.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
* Licensed under the Apache License, Version 2.0 (the `License`);
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an `AS IS` BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
116
firebase.initializeApp(config);
217

318
// Watch for state change from sign in
@@ -19,7 +34,6 @@ window.onload = function () {
1934
};
2035

2136
// [START cloudrun_end_user_firebase_sign_in]
22-
// [START run_end_user_firebase_sign_in]
2337
function signIn() {
2438
const provider = new firebase.auth.GoogleAuthProvider();
2539
provider.addScope('https://www.googleapis.com/auth/userinfo.email');
@@ -36,7 +50,6 @@ function signIn() {
3650
window.alert('Sign in failed. Retry or check your browser logs.');
3751
});
3852
}
39-
// [END run_end_user_firebase_sign_in]
4053
// [END cloudrun_end_user_firebase_sign_in]
4154

4255
function signOut() {
@@ -60,7 +73,6 @@ function toggle() {
6073
}
6174

6275
// [START cloudrun_end_user_token]
63-
// [START run_end_user_token]
6476
async function vote(team) {
6577
if (firebase.auth().currentUser) {
6678
// Retrieve JWT to identify the user to the Identity Platform service.
@@ -89,5 +101,4 @@ async function vote(team) {
89101
window.alert('User not signed in.');
90102
}
91103
}
92-
// [END run_end_user_token]
93104
// [END cloudrun_end_user_token]

run/markdown-preview/editor/app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ app.get('/', async (req, res) => {
4949
// The renderRequest makes a request to the Renderer service.
5050
// The request returns the Markdown text converted to HTML.
5151
// [START cloudrun_secure_request_do]
52-
// [START run_secure_request_do]
5352
app.post('/render', async (req, res) => {
5453
try {
5554
const markdown = req.body.data;
@@ -60,7 +59,6 @@ app.post('/render', async (req, res) => {
6059
res.status(500).send(err);
6160
}
6261
});
63-
// [END run_secure_request_do]
6462
// [END cloudrun_secure_request_do]
6563

6664
// Exports for testing purposes.

run/markdown-preview/editor/render.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
// [START cloudrun_secure_request]
16-
// [START run_secure_request]
1716
const {GoogleAuth} = require('google-auth-library');
1817
const got = require('got');
1918
const auth = new GoogleAuth();
@@ -58,7 +57,6 @@ const renderRequest = async markdown => {
5857
}
5958
};
6059

61-
// [END run_secure_request]
6260
// [END cloudrun_secure_request]
6361

6462
module.exports = renderRequest;

run/system-package/app.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const app = express();
2323
fs.accessSync('/usr/bin/dot', fs.constants.X_OK);
2424

2525
// [START cloudrun_system_package_handler]
26-
// [START run_system_package_handler]
2726
app.get('/diagram.png', (req, res) => {
2827
try {
2928
const image = createDiagram(req.query.dot);
@@ -41,11 +40,9 @@ app.get('/diagram.png', (req, res) => {
4140
}
4241
}
4342
});
44-
// [END run_system_package_handler]
4543
// [END cloudrun_system_package_handler]
4644

4745
// [START cloudrun_system_package_exec]
48-
// [START run_system_package_exec]
4946
// Generate a diagram based on a graphviz DOT diagram description.
5047
const createDiagram = dot => {
5148
if (!dot) {
@@ -66,7 +63,6 @@ const createDiagram = dot => {
6663
});
6764
return image;
6865
};
69-
// [END run_system_package_exec]
7066
// [END cloudrun_system_package_exec]
7167

7268
module.exports = app;

0 commit comments

Comments
 (0)