-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #68
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||||
|
||||||||||||
| base_url = APP_BASE_URL.replace('/api', '') # Ensure we have the root URL | |
| from urllib.parse import urlparse, urlunparse | |
| parsed_url = urlparse(APP_BASE_URL) | |
| path = parsed_url.path.rstrip('/api') if parsed_url.path.endswith('/api') else parsed_url.path | |
| base_url = urlunparse(parsed_url._replace(path=path)) # Ensure we have the root URL |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for missing APP_BASE_URL will never execute because
os.getenv('APP_BASE_URL', 'http://localhost:8080')always returns a non-empty string. Consider removing the default in getenv or adjusting this logic to detect an unset environment variable correctly.