feat: subdomain routing por tenant — refac-xxx.nexusautoparts.com
- Nginx wildcard config: *.nexusautoparts.com routes to POS app with X-Tenant-Subdomain header - middleware_tenant.py: resolves subdomain -> tenant_id via nexus_master.tenants.subdomain - auth_bp: login and employee list endpoints accept tenant from subdomain, URL param, or body - login.html: auto-detects tenant from subdomain, shows business name, falls back to ?tenant=ID - tenant_manager: generates subdomain slug from business name on provision_tenant() - Migration v1.2: adds subdomain column + unique index to tenants table - setup-nginx.sh: one-command install script for the nginx config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
24
nginx/setup-nginx.sh
Executable file
24
nginx/setup-nginx.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# Setup Nginx config for Nexus POS subdomain routing
|
||||
# Usage: sudo bash setup-nginx.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_SRC="/home/Autopartes/nginx/nexus-pos.conf"
|
||||
CONF_DEST="/etc/nginx/sites-available/nexus-pos"
|
||||
|
||||
echo "==> Copying nginx config..."
|
||||
sudo cp "$CONF_SRC" "$CONF_DEST"
|
||||
|
||||
echo "==> Creating symlink in sites-enabled..."
|
||||
sudo ln -sf "$CONF_DEST" /etc/nginx/sites-enabled/
|
||||
|
||||
echo "==> Testing nginx config..."
|
||||
if sudo nginx -t; then
|
||||
echo "==> Config OK. Reloading nginx..."
|
||||
sudo systemctl reload nginx
|
||||
echo "==> Done. Subdomain routing active."
|
||||
else
|
||||
echo "!!! Nginx config test failed. NOT reloading."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user