Skip to content

Environment Variables

Complete reference for all TruSpace configuration options.

Quick Reference

Category Variables
Core NODE_ENV, LOG_LEVEL
Network CORS_ORIGIN, FRONTEND_PORT, BACKEND_PORT
IPFS IPFS_*, CLUSTER_*
AI OLLAMA_*, DISABLE_ALL_AI_FUNCTIONALITY
Security JWT_SECRET, CLUSTER_SECRET

Core Settings

NODE_ENV

Application environment mode.

Value Description
development Development mode with verbose logging
production Production mode with optimized settings
NODE_ENV=production

LOG_LEVEL

Logging verbosity level.

Value Description
debug All messages including debug
info Informational messages and above
warn Warnings and errors only
error Errors only
LOG_LEVEL=info

Network Settings

CORS_ORIGIN

Allowed origins for CORS requests. Set to your domain.

# Local development
CORS_ORIGIN=http://localhost:3000

# Production
CORS_ORIGIN=https://yourdomain.com

FRONTEND_PORT

Port for the frontend service.

FRONTEND_PORT=3000

BACKEND_PORT

Port for the backend API service.

BACKEND_PORT=8000

OI_CORS_ALLOW_ORIGIN

CORS origin for Open Web UI.

OI_CORS_ALLOW_ORIGIN=http://localhost:3000

IPFS Settings

IPFS_PROFILE

IPFS configuration profile.

Value Description
server Optimized for servers (default)
lowpower Reduced resource usage for Pi/embedded
IPFS_PROFILE=server

IPFS_BOOTSTRAP_REMOVE

Remove default IPFS bootstrap nodes (for private networks).

IPFS_BOOTSTRAP_REMOVE=true

IPFS_PATH

Custom IPFS data directory.

IPFS_PATH=/custom/ipfs/path

IPFS Cluster Settings

CLUSTER_SECRET

Shared secret for cluster authentication. Must be the same on all connected nodes.

Security

Generate a unique secret for production:

openssl rand -hex 32

CLUSTER_SECRET=your-32-byte-hex-secret-here

CLUSTER_PEERNAME

Human-readable name for this cluster peer.

CLUSTER_PEERNAME=node-1

CLUSTER_REPLICATION_MIN

Minimum number of nodes that should pin each item.

CLUSTER_REPLICATION_MIN=2

CLUSTER_REPLICATION_MAX

Maximum number of nodes that should pin each item.

CLUSTER_REPLICATION_MAX=3

AI Settings

DISABLE_ALL_AI_FUNCTIONALITY

Completely disable AI features.

# Enable AI (default)
DISABLE_ALL_AI_FUNCTIONALITY=false

# Disable AI
DISABLE_ALL_AI_FUNCTIONALITY=true

OLLAMA_MODEL

Default LLM model for AI analysis.

Model Size Quality Speed
tinyllama 637 MB Basic Fast
phi3 2.2 GB Good Medium
llama3.2:3b 2.0 GB Good Medium
llama3.2:7b 4.7 GB Better Slower
mistral 4.1 GB Better Slower
OLLAMA_MODEL=llama3.2:3b

OLLAMA_HOST

Ollama API host (if running separately).

OLLAMA_HOST=http://localhost:11434

OLLAMA_GPU

Enable GPU acceleration.

# Auto-detect (default)
OLLAMA_GPU=auto

# Force CPU
OLLAMA_GPU=cpu

Security Settings

JWT_SECRET

Secret key for JWT token signing.

Security

Generate a unique secret for production:

openssl rand -hex 64

JWT_SECRET=your-very-long-secret-key-here

JWT_EXPIRY

JWT token expiration time.

JWT_EXPIRY=24h

BCRYPT_ROUNDS

Number of bcrypt hashing rounds.

BCRYPT_ROUNDS=12

Build Settings

BUILD_OR_PULL_IMAGES

Whether to build images locally or pull from registry.

Value Description
pull Pull pre-built images (default, faster)
build Build images locally
BUILD_OR_PULL_IMAGES=pull

Example Configurations

Local Development

.env
NODE_ENV=development
LOG_LEVEL=debug
CORS_ORIGIN=http://localhost:3000
FRONTEND_PORT=3000
BACKEND_PORT=8000
OLLAMA_MODEL=tinyllama

Production

.env
NODE_ENV=production
LOG_LEVEL=info
CORS_ORIGIN=https://truspace.example.com
FRONTEND_PORT=3000
BACKEND_PORT=8000
JWT_SECRET=<generated-secret>
CLUSTER_SECRET=<generated-secret>
OLLAMA_MODEL=llama3.2:7b
BUILD_OR_PULL_IMAGES=pull

Raspberry Pi

.env
NODE_ENV=production
LOG_LEVEL=info
IPFS_PROFILE=lowpower
DISABLE_ALL_AI_FUNCTIONALITY=true
CORS_ORIGIN=http://raspberrypi.local:3000

Applying Changes

After modifying .env:

# Restart services
docker compose down
docker compose up -d

# Or use start.sh
./start.sh