fix: load .env in production systemd service for chat API keys

- Add EnvironmentFile=/home/txeo/Git/yo/cv/.env to systemd unit
- Add production overrides (GO_ENV, BEHIND_PROXY, ALLOWED_ORIGINS)
- Deploy workflow now auto-updates systemd service file on each deploy
This commit is contained in:
juanatsap
2026-04-09 11:04:38 +01:00
parent 8e029d1363
commit 482350a924
2 changed files with 13 additions and 2 deletions
+5
View File
@@ -70,6 +70,11 @@ jobs:
# git stash pop || echo "⚠️ Could not reapply stash (conflicts?)"
# fi
# Update systemd service file if changed
echo "📋 Updating systemd service..."
sudo cp config/systemd/cv.service /etc/systemd/system/$SERVICE_NAME.service
sudo systemctl daemon-reload
echo "🔄 Restarting service..."
sudo systemctl restart $SERVICE_NAME
+8 -2
View File
@@ -10,11 +10,17 @@ Group=txeo
WorkingDirectory=/home/txeo/Git/yo/cv
ExecStart=/usr/bin/go run .
# Environment variables
# Load environment from .env file (API keys, SMTP, chat config)
EnvironmentFile=/home/txeo/Git/yo/cv/.env
# Production overrides (take precedence over .env)
Environment="GO_ENV=production"
Environment="PORT=1999"
Environment="BASE_URL=https://juan.andres.morenorub.io"
Environment="VERSION=1.0.0"
Environment="TEMPLATE_HOT_RELOAD=false"
Environment="BEHIND_PROXY=true"
Environment="TRUSTED_PROXY_IP=127.0.0.1"
Environment="ALLOWED_ORIGINS=juan.andres.morenorub.io"
# Restart policy
Restart=always