Make SITE_URL and AUTH_SECRET configurable via environment variables for any deployment

This commit is contained in:
2025-10-01 23:12:22 -04:00
parent bd33432721
commit 966f1bae5d
4 changed files with 70 additions and 14 deletions

View File

@@ -21,6 +21,31 @@ A web application for managing and displaying weekly sermons for New Life Christ
- **QR Codes**: qrcode library
- **Deployment**: Docker & Docker Compose
## Configuration
This application uses environment variables for configuration. These must be set before building the Docker image.
### Environment Variables
| Variable | Description | Required | Default |
|----------|-------------|----------|---------|
| `SITE_URL` | Public URL where the app is hosted (used for QR codes) | Yes | `https://nlcc.rydertech.us` |
| `AUTH_SECRET` | Secret key for authentication sessions | Yes | `change-this-secret-in-production` |
### Setting Up Environment Variables
Create a `.env` file in the project root:
```bash
SITE_URL=https://your-church-domain.com
AUTH_SECRET=your-secure-random-secret-here
```
**Generate a secure AUTH_SECRET:**
```bash
openssl rand -hex 32
```
## Getting Started
### Prerequisites
@@ -35,19 +60,29 @@ git clone <repository-url>
cd nlcc-itinerary
```
2. Update environment variables in `docker-compose.yml`:
```yaml
environment:
- AUTH_SECRET=your-secret-key-change-in-production
- SITE_URL=https://newlife-christian.com
```
3. Build and run with Docker Compose:
2. Create a `.env` file from the example:
```bash
docker-compose up -d
cp .env.example .env
```
The application will be available at `http://localhost:3000`
3. Edit `.env` and configure your settings:
```bash
# Required: Set your public URL (used for QR codes)
SITE_URL=https://your-domain.com
# Required: Set a secure authentication secret
# Generate with: openssl rand -hex 32
AUTH_SECRET=your-secure-random-secret-here
```
4. Build and run with Docker Compose:
```bash
docker-compose up -d --build
```
The application will be available at `http://localhost:3002` (or your configured port)
**Important**: The `SITE_URL` must be set correctly for QR codes to work. This should be the public URL where your application is accessible (e.g., `https://church.example.com`).
### Default Credentials