diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd834c4..a89da3e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,9 +40,9 @@ jobs: - name: Deploy to Cloud Run run: | - gcloud run deploy contacts-generator-backend-continuous \ + gcloud run deploy contactify-backend \ --image shivamgutgutia/contactify:latest \ --region asia-south1 \ --project=shivam-contacts-generator \ - && gcloud run services update-traffic contacts-generator-backend-continuous --to-latest --region=asia-south1\ + && gcloud run services update-traffic contactify-backend --to-latest --region=asia-south1\ --platform managed diff --git a/app.py b/app.py index af55671..6c5e613 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, jsonify +from flask import Flask, jsonify, request from flask_cors import CORS from dotenv import load_dotenv import os @@ -6,12 +6,22 @@ import traceback load_dotenv() + app= Flask(__name__) #CORS(app) CORS(app, resources={r"/*": {"origins": "https://contactify.codechefvit.com", "methods": ["GET", "POST"]}}) app.config['MAX_CONTENT_LENGTH'] = 1024*1024*1024 +# def check_origin(): +# if "Origin" not in request.headers or request.headers["Origin"] != "https://contactify.codechefvit.com": +# return False +# return True +# @app.before_request +# def before_request(): +# # Check if the request origin is allowed +# if request.method != 'OPTIONS' and not check_origin(): +# return jsonify({"error": "Forbidden"}), 403 app.register_blueprint(router)