refactor: rename Wizamart to Orion across entire codebase

Replace all ~1,086 occurrences of Wizamart/wizamart/WIZAMART/WizaMart
with Orion/orion/ORION across 184 files. This includes database
identifiers, email addresses, domain references, R2 bucket names,
DNS prefixes, encryption salt, Celery app name, config defaults,
Docker configs, CI configs, documentation, seed data, and templates.

Renames homepage-wizamart.html template to homepage-orion.html.
Fixes duplicate file_pattern key in api.yaml architecture rule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 16:46:56 +01:00
parent 34ee7bb7ad
commit e9253fbd84
184 changed files with 1227 additions and 1228 deletions

View File

@@ -21,7 +21,7 @@
## Overview
The Wizamart platform uses **automatic environment detection** to determine the runtime environment (development, staging, or production) and adjust security settings accordingly.
The Orion platform uses **automatic environment detection** to determine the runtime environment (development, staging, or production) and adjust security settings accordingly.
### Why Auto-Detection?
@@ -158,7 +158,7 @@ from app.core.environment import is_development, is_production
def debug_info():
if not is_development():
raise HTTPException(status_code=404, detail="Not found")
# Only accessible in development
return {
"database": get_db_info(),
@@ -226,7 +226,7 @@ from app.core.environment import get_environment
def configure_logging():
env = get_environment()
if env == "development":
# Verbose logging for development
logging.basicConfig(
@@ -255,10 +255,10 @@ from app.core.environment import get_cached_environment
def process_request(request: Request):
# Use cached version for frequent calls
env = get_cached_environment() # Cached - faster
# Instead of:
# env = get_environment() # Re-detects every time
if env == "production":
# Production-specific optimization
use_cache = True
@@ -335,7 +335,7 @@ ExecStart=/usr/bin/uvicorn main:app --host 0.0.0.0 --port 8000
```yaml
services:
web:
image: wizamart:latest
image: orion:latest
environment:
- ENV=production
ports:
@@ -421,14 +421,14 @@ from app.core.environment import get_environment, should_use_secure_cookies
def test_environment_detection_with_env_var():
"""Test environment detection with ENV variable."""
os.environ["ENV"] = "production"
# Clear cache first
import app.core.environment as env_module
env_module._cached_environment = None
assert get_environment() == "production"
assert should_use_secure_cookies() == True
# Cleanup
del os.environ["ENV"]
@@ -437,11 +437,11 @@ def test_environment_defaults_to_development():
# Ensure no env vars set
os.environ.pop("ENV", None)
os.environ.pop("ENVIRONMENT", None)
# Clear cache
import app.core.environment as env_module
env_module._cached_environment = None
assert get_environment() == "development"
assert should_use_secure_cookies() == False
```
@@ -453,17 +453,17 @@ def test_login_sets_secure_cookie_in_production(test_client, monkeypatch):
"""Test that login sets secure cookie in production."""
# Mock production environment
monkeypatch.setenv("ENV", "production")
# Clear cache
import app.core.environment as env_module
env_module._cached_environment = None
# Test login
response = test_client.post("/api/v1/admin/auth/login", json={
"username": "admin",
"password": "admin123"
})
# Check cookie has secure flag
set_cookie_header = response.headers.get("set-cookie")
assert "Secure" in set_cookie_header
@@ -481,7 +481,7 @@ from app.core.environment import get_environment, should_use_secure_cookies
async def startup_event():
env = get_environment()
secure = should_use_secure_cookies()
print(f"🌍 Environment: {env}")
print(f"🔒 Secure cookies: {secure}")
print(f"📍 Running on: {os.getenv('HOSTNAME', 'localhost')}")
@@ -498,7 +498,7 @@ def debug_environment():
"""Debug endpoint to check environment detection."""
if not is_development():
raise HTTPException(status_code=404)
return {
"detected_environment": get_environment(),
"should_use_secure_cookies": should_use_secure_cookies(),
@@ -518,8 +518,8 @@ def debug_environment():
**Setup:**
```bash
# Clone repo
git clone <wizamart-repo>
cd wizamart-repo
git clone <orion-repo>
cd orion-repo
# Create virtual environment
python -m venv venv
@@ -553,16 +553,16 @@ services:
build: .
environment:
- ENV=staging
- DATABASE_URL=postgresql://user:pass@db:5432/wizamart_staging
- DATABASE_URL=postgresql://user:pass@db:5432/orion_staging
ports:
- "8000:8000"
depends_on:
- db
db:
image: postgres:15
environment:
- POSTGRES_DB=wizamart_staging
- POSTGRES_DB=orion_staging
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
```
@@ -572,13 +572,13 @@ services:
apiVersion: apps/v1
kind: Deployment
metadata:
name: wizamart-staging
name: orion-staging
spec:
template:
spec:
containers:
- name: web
image: wizamart:latest
image: orion:latest
env:
- name: ENV
value: "staging"
@@ -599,15 +599,15 @@ spec:
**systemd Service:**
```ini
[Unit]
Description=Wizamart Platform
Description=Orion Platform
After=network.target
[Service]
User=wizamart
WorkingDirectory=/opt/wizamart
User=orion
WorkingDirectory=/opt/orion
Environment="ENV=production"
Environment="DATABASE_URL=postgresql://user:pass@localhost/wizamart_prod"
ExecStart=/opt/wizamart/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
Environment="DATABASE_URL=postgresql://user:pass@localhost/orion_prod"
ExecStart=/opt/orion/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
Restart=always
[Install]
@@ -742,42 +742,42 @@ class TestEnvironmentDetection:
# Clear any env vars
os.environ.pop("ENV", None)
os.environ.pop("ENVIRONMENT", None)
assert get_environment() == "development"
assert is_development() == True
assert is_production() == False
assert should_use_secure_cookies() == False
def test_env_variable_production(self, monkeypatch):
"""Test ENV=production detection."""
monkeypatch.setenv("ENV", "production")
assert get_environment() == "production"
assert is_production() == True
assert should_use_secure_cookies() == True
def test_environment_variable_staging(self, monkeypatch):
"""Test ENVIRONMENT=staging detection."""
monkeypatch.setenv("ENVIRONMENT", "staging")
assert get_environment() == "staging"
assert is_staging() == True
assert should_use_secure_cookies() == True
def test_env_takes_priority_over_environment(self, monkeypatch):
"""Test that ENV variable has priority."""
monkeypatch.setenv("ENV", "production")
monkeypatch.setenv("ENVIRONMENT", "staging")
# ENV should win
assert get_environment() == "production"
def test_debug_true_is_development(self, monkeypatch):
"""Test that DEBUG=true results in development."""
monkeypatch.delenv("ENV", raising=False)
monkeypatch.delenv("ENVIRONMENT", raising=False)
monkeypatch.setenv("DEBUG", "true")
assert get_environment() == "development"
@@ -786,7 +786,7 @@ class TestCookieSecurity:
"""Test cookies are secure in production."""
monkeypatch.setenv("ENV", "production")
assert should_use_secure_cookies() == True
def test_insecure_cookies_in_development(self):
"""Test cookies are not secure in development."""
os.environ.pop("ENV", None)
@@ -803,21 +803,21 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
"username": "admin",
"password": "admin123"
})
set_cookie = response.headers.get("set-cookie", "")
assert "Secure" not in set_cookie # No Secure in development
# Test production
monkeypatch.setenv("ENV", "production")
# Clear cache
import app.core.environment as env_module
env_module._cached_environment = None
response = test_client.post("/api/v1/admin/auth/login", json={
"username": "admin",
"password": "admin123"
})
set_cookie = response.headers.get("set-cookie", "")
assert "Secure" in set_cookie # Secure in production
```
@@ -854,7 +854,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
def send_email(to: str, subject: str):
"""
Send email to recipient.
Environment behavior:
- Development: Logs email to console (no actual send)
- Staging: Sends to test email address
@@ -887,7 +887,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
# ❌ Bad
if os.getenv("ENV") == "production":
use_https = True
# ✅ Good
use_https = should_use_secure_cookies()
```
@@ -896,7 +896,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
```python
# ❌ Bad - assumes production
response.set_cookie(secure=True)
# ✅ Good - adapts to environment
response.set_cookie(secure=should_use_secure_cookies())
```
@@ -907,7 +907,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
FORCE_PRODUCTION = True
if FORCE_PRODUCTION:
...
# ✅ Good - use environment variable
# export ENV=production
if is_production():
@@ -921,7 +921,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
log_level = "WARNING"
elif is_development():
log_level = "DEBUG"
# ✅ Good - consistent
env = get_environment()
if env == "production":
@@ -936,7 +936,7 @@ def test_login_cookie_matches_environment(test_client, monkeypatch):
def test_production():
os.environ["ENV"] = "production"
assert get_environment() == "production" # May fail if cached
# ✅ Good - clear cache
def test_production():
import app.core.environment as env_module