Merge pull request #23 from LordMathis/chore/update-readme

Update README
This commit is contained in:
2024-11-30 22:11:17 +01:00
committed by GitHub

View File

@@ -9,7 +9,7 @@ Yet another markdown editor. Work in progress
- Git integration for version control
- Dark and light theme support
- Multiple workspaces
- Math equation support (KaTeX)
- Math equation support (MathJax)
- Code syntax highlighting
## Prerequisites
@@ -18,35 +18,52 @@ Yet another markdown editor. Work in progress
- Node.js 20 or later
- gcc (for go-sqlite3 package)
## Setup
## Configuration
Set the following environment variables:
NovaMD can be configured using environment variables. Here are the available configuration options:
- `CGO_ENABLED=1`: This is necessary for the go-sqlite3 package
- `NOVAMD_DB_PATH`: Path to the SQLite database file (default: "./sqlite.db")
- `NOVAMD_WORKDIR`: Directory for storing Markdown files (default: "./data")
- `NOVAMD_STATIC_PATH`: Path to the frontend build files (default: "../app/dist")
### Required Environment Variables
- `NOVAMD_ADMIN_EMAIL`: Email address for the admin account
- `NOVAMD_ADMIN_PASSWORD`: Password for the admin account
- `NOVAMD_ENCRYPTION_KEY`: Base64-encoded 32-byte key used for encrypting sensitive data
### Optional Environment Variables
- `NOVAMD_ENV`: Set to "development" to enable development mode
- `NOVAMD_DB_PATH`: Path to the SQLite database file (default: "./novamd.db")
- `NOVAMD_WORKDIR`: Working directory for application data (default: "./data")
- `NOVAMD_STATIC_PATH`: Path to static files (default: "../app/dist")
- `NOVAMD_PORT`: Port to run the server on (default: "8080")
- `NOVAMD_ADMIN_EMAIL`: Admin user email
- `NOVAMD_ADMIN_PASSWORD`: Admin user password
- `NOVAMD_ENCRYPTION_KEY`: 32-byte key for encrypting sensitive data
- `NOVAMD_APP_URL`: Full URL where the application is hosted
- `NOVAMD_CORS_ORIGINS`: Comma-separated list of allowed CORS origins
- `NOVAMD_JWT_SIGNING_KEY`: Key used for signing JWT tokens (autogenerated if not set)
- `NOVAMD_RATE_LIMIT_REQUESTS`: Number of allowed requests per window (default: 100)
- `NOVAMD_RATE_LIMIT_WINDOW`: Duration of the rate limit window (default: 15m)
To generate a secure encryption key you can use openssl:
### Generating Encryption Keys
The encryption key must be a base64-encoded 32-byte value. You can generate a secure encryption key using OpenSSL:
```bash
# Generate a random 32-byte key and encode it as base64
openssl rand -base64 32
```
## Running the Backend
Store the generated key securely - it will be needed to decrypt any data encrypted by the application. If the key is lost or changed, previously encrypted data will become inaccessible.
## Running the backend server
1. Navigate to the `server` directory
2. Ensure all environment variables are set
3. Run the server:
2. Install dependecies: `go mod tidy`
3. Ensure all environment variables are set
4. Additionally set `CGO_ENABLED=1` (needed for sqlite3)
5. Run the server:
```
go run cmd/server/main.go
```
## Running the Frontend
## Running the frontend app
1. Navigate to the `app` directory
2. Install dependencies:
@@ -59,7 +76,7 @@ openssl rand -base64 32
```
The frontend will be available at `http://localhost:3000`
## Building for Production
## Building for production
1. Build the frontend app:
```
@@ -86,3 +103,7 @@ A Dockerfile is provided for easy deployment. To build and run the Docker image:
```
docker run -p 8080:8080 -v /path/to/data:/app/data novamd
```
## Upgrading
Before first stable release (1.0.0) there is not upgrade path. You have to delete the database file and start over.