activate_this_file = "/var/www/html/api-medvista/venv/bin/activate_this.py"
with open(activate_this_file) as _file:
     exec(_file.read(), dict(__file__=activate_this_file))
from flask import Flask, request, jsonify
from flask_cors import CORS
from flask_mail import Mail
from conf import Config

app = Flask(__name__)
CORS(app)

# Load config for mail
app.config.from_object(Config)

# Initialize Flask-Mail
mail = Mail(app)

# Register Swagger UI blueprint
app.register_blueprint(Config.swaggerui_blueprint, url_prefix=Config.SWAGGER_URL)


API_KEY = "FT0EwbwfCW9zyDxHNzmSM@&lG<@Xv4xp"  # Replace with your actual API key

def require_api_key(f):
    def decorator(*args, **kwargs):
        api_key = request.headers.get('x-medvista-api-key')
        if api_key == API_KEY:
            return f(*args, **kwargs)
        else:
            return jsonify({'message': 'Invalid API key', 'error': 'true'}), 403
    return decorator

from routes import *

def index():
    return "Hello world"

if __name__ == '__main__':
    app.run(debug=True)
