From 90aca6cca486762a0087796ecdafabc36dc2f041 Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Mon, 5 Jan 2026 15:42:54 -0800 Subject: [PATCH] hopefully fix workers not kloading the key --- .env.example | 11 +++++++++-- config/gunicorn.conf.py | 17 ++--------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.env.example b/.env.example index bea4eab..09bdbab 100644 --- a/.env.example +++ b/.env.example @@ -6,17 +6,24 @@ BRICKSET_API_KEY = "your_brickset_api_key" # Square environment - "sandbox" for testing, "production" for live store SQUARE_ENV = "sandbox" # or "production" +# Public webhook URL that Square will POST events to SQUARE_WEBHOOK_URL = "https://yourdomain.com/hook" # Sandbox credentials - test environment (fake data, safe for development) SANDBOX_SQUARE_APP_ID = "your_sandbox_app_id" SANDBOX_SQUARE_TOKEN = "your_sandbox_access_token" -SANDBOX_SQUARE_WEBHOOK_INVENTORY_ID = "your_sandbox_webhook_signature_key" + +# Sandbox webhook subscription ID and signature key for verifying webhook requests +SANDBOX_SQUARE_WEBHOOK_SUB_ID = "your_sandbox_webhook_subscription_id" +SANDBOX_SQUARE_WEBHOOK_SIGNATURE_KEY = "your_sandbox_webhook_signature_key" # Production credentials - live store (real inventory and sales) PROD_SQUARE_APP_ID = "your_production_app_id" PROD_SQUARE_TOKEN = "your_production_access_token" -PROD_SQUARE_WEBHOOK_INVENTORY_ID = "your_production_webhook_signature_key" + +# Production webhook subscription ID and signature key for verifying webhook requests +PROD_SQUARE_WEBHOOK_SUB_ID = "your_production_webhook_subscription_id" +PROD_SQUARE_WEBHOOK_SIGNATURE_KEY = "your_production_webhook_signature_key" # Category ID for LEGO items in Square catalog (find in Dashboard → Items → Categories) SQUARE_LEGO_CAT_ID = "your_lego_category_id" \ No newline at end of file diff --git a/config/gunicorn.conf.py b/config/gunicorn.conf.py index 9d80f0d..54585e6 100644 --- a/config/gunicorn.conf.py +++ b/config/gunicorn.conf.py @@ -54,26 +54,13 @@ def on_starting(server): """Called just before the master process is initialized.""" print("Studspider WEB starting...") - # Load .env file before workers start - import dotenv + # Verify .env file exists (workers will load it via get_sq_env.py) from pathlib import Path env_path = Path(__file__).parent.parent / ".env" print(f"[@DEBUG] Looking for .env at: {env_path.absolute()}") if env_path.exists(): - dotenv.load_dotenv(env_path) - print(f"✓ Loaded environment from {env_path}") - - # Verify key was loaded - import os - - key = os.getenv("PROD_SQUARE_WEBHOOK_SIGNATURE_KEY") or os.getenv( - "SANDBOX_SQUARE_WEBHOOK_SIGNATURE_KEY" - ) - if key: - print(f"✓ SQUARE_WEBHOOK_SIGNATURE_KEY loaded: {key[:10]}...") - else: - print(f"⚠ SQUARE_WEBHOOK_SIGNATURE_KEY not found in .env") + print(f"✓ .env file found (workers will load via get_sq_env.py)") else: print(f"⚠ No .env file found at {env_path.absolute()}")