mirror of
https://github.com/ghndrx/k8s-game-2048.git
synced 2026-02-10 06:45:07 +00:00
- Add .env.example template with all configurable values - Create comprehensive .gitignore for personal data - Add sanitization script to remove hardcoded personal info - Add environment-aware deployment scripts - Add ENVIRONMENT.md documentation - Keep personal information in .env (gitignored) This makes the repository safe for public sharing while keeping personal domains, emails, and secrets secure.
3.0 KiB
3.0 KiB
Environment Configuration
This repository uses environment variables to keep personal information (domains, emails, repository names) out of the public codebase.
Quick Setup
-
Copy the environment template:
cp .env.example .env -
Edit
.envwith your information:nano .env -
Update these key values:
BASE_DOMAIN- Your domain (e.g.,example.com)GITHUB_REPOSITORY- Your GitHub repo (e.g.,username/k8s-game-2048)CERT_EMAIL- Your email for SSL certificatesWEBHOOK_SECRET- Generate with:openssl rand -hex 32
Environment Variables
Required Variables
| Variable | Description | Example |
|---|---|---|
BASE_DOMAIN |
Your base domain | example.com |
WEBHOOK_DOMAIN |
Webhook endpoint domain | webhook.example.com |
GITHUB_REPOSITORY |
Your GitHub repository | username/k8s-game-2048 |
CERT_EMAIL |
Email for SSL certificates | admin@example.com |
WEBHOOK_SECRET |
Secret for webhook security | Generated 64-char hex |
Auto-generated Domains
The following domains are automatically generated from BASE_DOMAIN:
- Development:
2048-dev.{BASE_DOMAIN} - Staging:
2048-staging.{BASE_DOMAIN} - Production:
2048.{BASE_DOMAIN}
Canonical Knative Domains
- Dev:
game-2048-dev.game-2048-dev.dev.{BASE_DOMAIN} - Staging:
game-2048-staging.game-2048-staging.staging.{BASE_DOMAIN} - Production:
game-2048-prod.game-2048-prod.{BASE_DOMAIN}
Security
- Never commit
.env- It's in.gitignorefor security - Use strong webhook secrets - Generate with
openssl rand -hex 32 - Rotate secrets regularly - Update webhook secret periodically
Deployment Scripts
Setup Webhook Handler
./scripts/setup-webhook-deployment.sh
Prepare Environment-Specific Manifests
./scripts/prepare-deployment.sh
Sanitize Repository (for public sharing)
./scripts/sanitize-repo.sh
GitHub Secrets
After setting up your .env, configure these GitHub repository secrets:
- Go to your repository Settings → Secrets and variables → Actions
- Add these secrets from your
.envfile:
WEBHOOK_SECRET=<from .env>
DEV_WEBHOOK_URL=https://<WEBHOOK_DOMAIN>/webhook/deploy
STAGING_WEBHOOK_URL=https://<WEBHOOK_DOMAIN>/webhook/deploy
PROD_WEBHOOK_URL=https://<WEBHOOK_DOMAIN>/webhook/deploy
KNATIVE_DOMAIN=<BASE_DOMAIN>
Template System
The repository uses a template system to keep personal information secure:
manifests/templates/- Sanitized templates with placeholdersmanifests/- Your actual deployment manifests (gitignored).env.example- Template for environment configuration
Development Workflow
- Clone repository
- Copy
.env.exampleto.env - Update
.envwith your configuration - Run
./scripts/prepare-deployment.sh - Deploy with
./scripts/setup-webhook-deployment.sh
This ensures your personal information stays private while keeping the codebase shareable.