diff --git a/.env.template b/.env.template index e8be869..719fdf2 100644 --- a/.env.template +++ b/.env.template @@ -1,17 +1,19 @@ -# Database Configuration -DB_URL=postgres +# Shared Database Configuration +DB_URL=localhost DB_PORT=5432 -DB_NAME=authdb -DB_USER=resellio -DB_PASSWORD=localpassword +DB_NAME=resellio_db +DB_USER=root +DB_PASSWORD=my_password -# Auth Service JWT Configuration -SECRET_KEY=a-very-secret-key-for-local-development-change-me +# JWT & Security Configuration +SECRET_KEY=a-very-secure-secret-key-for-jwt-256-bit ACCESS_TOKEN_EXPIRE_MINUTES=30 -ADMIN_SECRET_KEY=local-admin-secret-key -INITIAL_ADMIN_EMAIL=admin@resellio.com -INITIAL_ADMIN_PASSWORD=AdminPassword123! +ADMIN_SECRET_KEY=change-in-production -# SendGrid Email Configuration -EMAIL_API_KEY="api-key-placeholder" -EMAIL_FROM_EMAIL="sender-email-placeholder" +# Email (SendGrid) Configuration +EMAIL_API_KEY=YOUR_SENDGRID_API_KEY +# The email address that will appear in the "From" field +EMAIL_FROM_EMAIL=noreply@resellio.com +# The base URL of the application, used for constructing verification links +# For local testing, this points to the API Gateway +APP_BASE_URL=http://localhost:8080 diff --git a/backend/event_ticketing_service/.env.template b/backend/event_ticketing_service/.env.template deleted file mode 100644 index 81d96b8..0000000 --- a/backend/event_ticketing_service/.env.template +++ /dev/null @@ -1,5 +0,0 @@ -DB_URL=localhost -DB_PORT=5432 -DB_NAME=db_name -DB_USER=root -DB_PASSWORD=my_password diff --git a/backend/event_ticketing_service/app/services/email.py b/backend/event_ticketing_service/app/services/email.py index 324f89e..d4dddb6 100644 --- a/backend/event_ticketing_service/app/services/email.py +++ b/backend/event_ticketing_service/app/services/email.py @@ -10,6 +10,7 @@ SENDGRID_API_KEY = os.getenv("EMAIL_API_KEY") FROM_EMAIL = os.getenv("EMAIL_FROM_EMAIL", "tickets@resellio.com") +APP_BASE_URL = os.getenv("APP_BASE_URL", "http://localhost:8080") logger = logging.getLogger(__name__) @@ -52,23 +53,16 @@ def send_ticket_email( ): """ Send beautifully designed ticket confirmation email using SendGrid. - - Args: - to_email: Recipient's email address - user_name: Recipient's name - event_name: Name of the event - ticket_id: Ticket ID - event_date: Event date (formatted string) - event_time: Event time (formatted string) - venue: Venue name - seat: Seat number/code - - Returns: - bool: True if email was sent successfully, False otherwise """ if not SENDGRID_API_KEY: logger.error("SendGrid API key not set - cannot send emails") return False + if not APP_BASE_URL: + logger.error("APP_BASE_URL not set - cannot construct email links") + # Fallback to a generic domain if not set, but log an error + base_url = "http://resellio.com" + else: + base_url = APP_BASE_URL.replace('/api', '') # Ensure we have the root URL # Generate QR code containing ticket info qr_data = f"TICKET:{ticket_id}|EVENT:{event_name}|DATE:{event_date}|TIME:{event_time}|VENUE:{venue}|SEAT:{seat}" @@ -208,10 +202,8 @@ def send_ticket_email(
Please save this email and bring it with you to the event. You can also access your tickets anytime from your account.
-We hope you enjoy the event!
- @@ -219,9 +211,9 @@ def send_ticket_email(© 2025 Resellio. All rights reserved.
This is an automated message. Please do not reply to this email.
- Terms of Service | - Privacy Policy | - Contact Us + Terms of Service | + Privacy Policy | + Contact Us