docs: add environment setup instructions
- Add .env.example file with template for secure configuration - Update Quick Start section with detailed environment setup - Provide both .env file and docker-compose variable methods - Add security notes and password generation commands - Document default database credentials with security warning - Include instructions for generating secure JWT secrets and passwords
This commit is contained in:
@@ -32,16 +32,68 @@ A self-hosted ebook management system built with Go, PostgreSQL, HTMX, and Tailw
|
||||
|
||||
- Docker and Docker Compose
|
||||
|
||||
### Running the Application
|
||||
|
||||
1. Clone the repository
|
||||
2. Run the application:
|
||||
### Environment Setup
|
||||
|
||||
**Option 1: Create .env file**
|
||||
```bash
|
||||
docker-compose up --build
|
||||
# Copy the example environment file
|
||||
cp .env.example .env
|
||||
|
||||
# Edit with your secure values
|
||||
nano .env # or your preferred editor
|
||||
```
|
||||
|
||||
3. Access the application at http://localhost:8765
|
||||
**Required Environment Variables:**
|
||||
- `JWT_SECRET` - Secure random string for JWT authentication
|
||||
- `DBPASS` - PostgreSQL database password
|
||||
|
||||
### Generating Secure Values
|
||||
|
||||
**Generate JWT Secret:**
|
||||
```bash
|
||||
# Generate 64-byte secure random string
|
||||
JWT_SECRET=$(openssl rand -base64 64)
|
||||
```
|
||||
|
||||
**Generate Database Password:**
|
||||
```bash
|
||||
# Generate 32-character secure password
|
||||
DBPASS=$(openssl rand -base64 32 | tr -d '=' '/+' | cut -c1-32)
|
||||
```
|
||||
|
||||
**Add to .env:**
|
||||
```bash
|
||||
echo "JWT_SECRET=$JWT_SECRET" >> .env
|
||||
echo "DBPASS=$DBPASS" >> .env
|
||||
```
|
||||
|
||||
### Running the Application
|
||||
|
||||
**Option 1: Using .env file**
|
||||
1. Clone the repository
|
||||
2. Set up environment:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env with your secure values
|
||||
```
|
||||
3. Run the application:
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
4. Access the application at http://localhost:8765
|
||||
|
||||
**Option 2: Using docker-compose variables**
|
||||
1. Clone the repository
|
||||
2. Set environment variables directly:
|
||||
```bash
|
||||
export JWT_SECRET="your-secure-jwt-secret-key-here"
|
||||
export DBPASS="your-secure-database-password-here"
|
||||
```
|
||||
3. Run the application:
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
4. Access the application at http://localhost:8765
|
||||
|
||||
### Database
|
||||
|
||||
@@ -50,6 +102,8 @@ PostgreSQL runs on port 5432 with default credentials:
|
||||
- User: postgres
|
||||
- Password: password
|
||||
|
||||
**⚠️ Security Note**: Change the default password in production environments! Use the `DBPASS` environment variable to set a secure password.
|
||||
|
||||
## Development
|
||||
|
||||
### Development
|
||||
|
||||
Reference in New Issue
Block a user