Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions run/pubsub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
# limitations under the License.

# [START cloudrun_pubsub_server_setup]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a difference between cloudrun_pubsub_server_setup and cloudrun_pubsub_server?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in python, but if I don't have both region tags then audits will say cloudrun_pubsub_server is missing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to use one region tag. We don't always have complete 1:1 matches across languages

# [START run_pubsub_server_setup]
# [START cloudrun_pubsub_server]
import base64
import os

from flask import Flask, request


app = Flask(__name__)
# [END run_pubsub_server_setup]

# [END cloudrun_pubsub_server_setup]
# [END cloudrun_pubsub_server]


# [START cloudrun_pubsub_handler]
Expand Down Expand Up @@ -53,11 +53,3 @@ def index():

# [END run_pubsub_handler]
# [END cloudrun_pubsub_handler]


if __name__ == "__main__":
PORT = int(os.getenv("PORT")) if os.getenv("PORT") else 8080

# This is used when running locally. Gunicorn is used to run the
# application on Cloud Run. See entrypoint in Dockerfile.
app.run(host="127.0.0.1", port=PORT, debug=True)