This document explains environment-based configuration for Ten Second Tom, including environment variables, development modes, and advanced configuration scenarios.
Quick Start: Most users should use
tom setupfor initial configuration. This document covers advanced environment-based configuration for special use cases.
Related Documentation:
- Configuration Guide - Primary configuration via setup wizard
- Authentication Setup - SSH key configuration
- Security Policy - Security best practices
For most users: Use the interactive setup wizard:
# First-time setup (launches automatically)
tom today
# Manual setup/reconfiguration
tom setup
# View current configuration
tom config showConfiguration is stored in:
- Primary: User configuration file (
~/ten-second-tom/config/config.json) - Fallback:
appsettings.json(framework defaults only)
This document covers environment variable overrides and advanced scenarios.
Settings are loaded in this order (later sources override earlier ones):
appsettings.json(framework defaults)appsettings.{Environment}.json(environment-specific)- User Configuration (
~/ten-second-tom/config/config.json) - Environment Variables (runtime overrides)
- Command-line arguments (highest priority)
- Production deployments - Server/container environments
- CI/CD pipelines - Automated testing and deployment
- One-time overrides - Testing different settings temporarily
- Cross-platform scripts - Portable configuration
For local development: Use tom setup instead of manual environment variables.
Use double underscores (__) to specify nested configuration keys:
# Maps to: TenSecondTom:Llm:ApiKey
TenSecondTom__Llm__ApiKey=your-key
# Maps to: Llm:Provider
Llm__Provider=Anthropic
# Maps to: Serilog:MinimumLevel:Default
Serilog__MinimumLevel__Default=DebugLLM Configuration:
# Provider selection
Llm__Provider=OpenAI # or Anthropic
Llm__ApiKey=sk-your-key-here
Llm__Model=gpt-4o-mini # Optional, uses default if not set
# Legacy format (still supported)
TenSecondTom__Llm__Provider=OpenAI
TenSecondTom__Llm__ApiKey=sk-your-key-here
TenSecondTom__Llm__Model=gpt-4o-miniStorage Configuration:
# Absolute path (recommended for production)
TenSecondTom__MemoryDirectory=/Users/chris/Documents/tom-data
# Home-relative path (portable across users)
TenSecondTom__MemoryDirectory=~/ten-second-tom
# Relative path (resolved from current working directory)
TenSecondTom__MemoryDirectory=./tom-dataPath Resolution: Relative paths (e.g.,
./data) are resolved from the current working directory where you run the app, not the binary location. For production, use absolute (/path/to/data) or home-relative (~/data) paths.
Audio Configuration:
# STT Provider Selection
TenSecondTom__Audio__SttProvider=built-in-local # or openai, whisper-cpp
TenSecondTom__Audio__SttApiKey=sk-your-api-key-here # Only needed for openai provider
# Recording Settings
TenSecondTom__Audio__Recorder__InputVolume=1.0
TenSecondTom__Audio__Recorder__EnableNoiseReduction=true
TenSecondTom__Audio__Recorder__EnableFrequencyFilters=true
# Preprocessing Settings
TenSecondTom__Audio__Preprocessing__RemoveSilence=true
TenSecondTom__Audio__Preprocessing__SilenceThresholdDb=-50
TenSecondTom__Audio__Preprocessing__MinimumSilenceDurationMs=500SSH Configuration:
Ssh__KeyPath=~/.ssh/id_ed25519
Ssh__KeySource=ManualPathLogging:
Serilog__MinimumLevel__Default=Information
Serilog__MinimumLevel__Default=Debug # More verboseApplication Environment:
DOTNET_ENVIRONMENT=Development # or Production, StagingmacOS/Linux (bash/zsh):
export Llm__Provider=Anthropic
export Llm__ApiKey=sk-ant-your-key-here
export DOTNET_ENVIRONMENT=Development
# Run application
tom todayWindows (PowerShell):
$env:Llm__Provider="Anthropic"
$env:Llm__ApiKey="sk-ant-your-key-here"
$env:DOTNET_ENVIRONMENT="Development"
# Run application
tom todayWindows (Command Prompt):
set Llm__Provider=Anthropic
set Llm__ApiKey=sk-ant-your-key-here
set DOTNET_ENVIRONMENT=Development
tom today# Test with different model temporarily
Llm__Model=gpt-4o tom today
# Use different memory directory
TenSecondTom__Storage__MemoryDirectory=/tmp/test-memory tom todaymacOS/Linux (~/.zshrc or ~/.bashrc):
# Add to end of file
export DOTNET_ENVIRONMENT=Development
export Llm__Provider=Anthropic
export Llm__ApiKey=sk-ant-your-key-here
# Reload shell
source ~/.zshrc # or source ~/.bashrcWindows (PowerShell Profile):
# Open profile
notepad $PROFILE
# Add lines:
$env:DOTNET_ENVIRONMENT="Development"
$env:Llm__Provider="Anthropic"
$env:Llm__ApiKey="sk-ant-your-key-here"Create a .env file in your working directory:
# Copy the example
cp example.env .env
# Edit with your settings
DOTNET_ENVIRONMENT=Development
Llm__Provider=Anthropic
Llm__ApiKey=sk-ant-your-key-hereNotes:
.envfiles are automatically loaded at startup- Already in
.gitignoreto prevent committing secrets - Supplementary to user configuration (doesn't replace config.json)
- Environment variables in
.envoverride configuration file settings
.env file approach stores secrets in plain text. For production, use proper secrets management.
Enable development mode for local testing and debugging:
export DOTNET_ENVIRONMENT=Development
tom todayWhen DOTNET_ENVIRONMENT=Development:
- Mock Authentication - Bypasses SSH key requirements (for testing)
- Debug Logging - More verbose output
- Development Warnings - Visible CLI warnings
- Relaxed Validation - Some checks are loosened
You'll see:
⚠ Development Mode: Authentication bypassed
[WRN] Using MockAuthenticationService - authentication bypassed for development
# Create .env file (optional, supplementary to config.json)
cat > .env << EOF
DOTNET_ENVIRONMENT=Development
EOF
# Run setup wizard (stores config in ~/ten-second-tom/config/config.json)
tom setup
# Run the app
tom today- Install via package manager (Homebrew, Winget, etc.)
- Use environment variables for any runtime overrides
- Use configuration file (
~/ten-second-tom/config/config.json) for persistent settings - Use shipped configuration files only for framework defaults (logging)
env:
DOTNET_ENVIRONMENT: Production
Llm__Provider: OpenAI
Llm__ApiKey: ${{ secrets.OPENAI_API_KEY }}
Llm__Model: gpt-4o-mini# Test different model without changing saved config
Llm__Model=gpt-4o tom today
# Use different memory directory for testing
TenSecondTom__Storage__MemoryDirectory=/tmp/test tom todayCreate environment-specific config files:
appsettings.Development.json:
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug"
}
}
}appsettings.Production.json:
{
"Serilog": {
"MinimumLevel": {
"Default": "Information"
}
}
}Switch environments:
DOTNET_ENVIRONMENT=Development tom today # Uses appsettings.Development.json
DOTNET_ENVIRONMENT=Production tom today # Uses appsettings.Production.json#!/bin/bash
# backup-memories.sh
export DOTNET_ENVIRONMENT=Production
export Llm__Provider=OpenAI
export Llm__ApiKey="${OPENAI_API_KEY}" # From parent environment
export TenSecondTom__Storage__MemoryDirectory="${MEMORY_DIR:-~/.tom/memory}"
tom today
tom thisweekProblem: Environment variable changes don't seem to apply.
Solutions:
- Restart your shell - Environment variables are set at shell startup
- Check spelling - Variable names are case-sensitive
- Verify double underscores - Use
__not:in env vars - Check hierarchy - Configuration file may be overriding your environment variables
# View all environment variables
env | grep -i tensecondtom
env | grep -i llm
# Check what the app sees
tom config showProblem: Settings in .env file are ignored.
Solutions:
- Check file location -
.envmust be in the working directory where you runtom - Verify format - No spaces around
=, one variable per line - Restart application -
.envis loaded once at startup - Check for quotes - Usually don't need quotes unless value has spaces
# Correct format
Llm__Provider=OpenAI
Llm__ApiKey=sk-test123
# Incorrect
Llm__Provider = OpenAI # ❌ spaces around =
Llm__ApiKey="sk-test" # ⚠️ quotes usually not neededProblem: Not sure which configuration source is being used.
Solution: Check the effective configuration:
tom config show
# Look for the storage location at the bottom:
# "Configuration loaded from: ~/ten-second-tom/config/config.json"Remember: Environment variables override configuration file settings.
# config.json has: Llm__Provider=OpenAI
# Environment sets:
export Llm__Provider=Anthropic
# Result: Anthropic is used (environment wins)
tom config show- Use
tom setupfor local development (stores in~/ten-second-tom/config/config.json) - Use environment variables for production deployments
- Store secrets in CI/CD secret managers
- Keep
.envin.gitignore - Protect
config.jsonwith proper file permissions - Regularly rotate API keys
- Use minimal permission scopes
- Commit secrets to version control
- Share
.envfiles - Store secrets in
appsettings.json - Use hardcoded secrets in scripts
- Expose secrets in logs or error messages
- Reuse secrets across environments
✅ Recommended: tom setup → ~/ten-second-tom/config/config.json
- Interactive wizard
- Centralized configuration
- Easy to update with
tom config
✅ Recommended: Environment variables
- No files to manage
- Works with containers
- Integrates with secret managers
✅ Recommended: Inline environment variables
- Temporary changes
- No config pollution
- Easy to script
Need More Help?
- Configuration Guide: CONFIGURATION.md
- Authentication Setup: AUTHENTICATION.md
- Security Policy: ../SECURITY.md
- Report Issues: GitHub Issues