Skip to content

Commit 9aee0e3

Browse files
Initial Commit
0 parents  commit 9aee0e3

File tree

143 files changed

+69480
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+69480
-0
lines changed

.dockerignore

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Documentation
6+
*.md
7+
docs/
8+
9+
# IDE files
10+
.vscode/
11+
.idea/
12+
*.swp
13+
*.swo
14+
*~
15+
16+
# OS files
17+
.DS_Store
18+
Thumbs.db
19+
20+
# Go build artifacts
21+
*.exe
22+
*.exe~
23+
*.dll
24+
*.so
25+
*.dylib
26+
cortex
27+
Cortex
28+
cortex-*
29+
30+
# Test files
31+
*.test
32+
coverage.out
33+
*.prof
34+
35+
# Temporary files
36+
*.tmp
37+
*.temp
38+
39+
# CI/CD
40+
.github/
41+
.gitlab-ci.yml
42+
.travis.yml
43+
44+
# Local development
45+
config.json
46+
config-*.json
47+
.env
48+
.env.local
49+
*.key
50+
*.pem
51+
ssl/
52+
53+
# Logs
54+
*.log
55+
logs/
56+
57+
# Local databases
58+
*.db
59+
*.sqlite
60+
*.sqlite3
61+
62+
# Cache
63+
.cache/
64+
tmp/
65+
66+
# Docker
67+
Dockerfile*
68+
docker-compose*.yml
69+
.dockerignore
70+
71+
# Scripts not needed in container
72+
scripts/
73+
Makefile
74+
75+
# Examples not needed in production
76+
examples/
77+
78+
# Tests not needed in runtime
79+
tests/
80+
*_test.go
81+
82+
# Build artifacts
83+
build/
84+
dist/
85+
out/
86+
87+
# Package files
88+
*.tar.gz
89+
*.zip
90+
*.7z
91+
92+
# Local development tools
93+
air.toml
94+
.air.toml
95+
.watch.toml
96+
97+
# Coverage reports
98+
coverage.html
99+
coverage.xml

.env.auth.template

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Cortex Authentication Environment Variables Template
2+
# Copy this file to .env and customize the values
3+
4+
# Database Configuration
5+
DB_DRIVER=postgres
6+
DB_DSN=postgres://router_user:secure_password@localhost/go_llm_router?sslmode=disable
7+
DB_MAX_OPEN_CONNS=25
8+
DB_MAX_IDLE_CONNS=5
9+
DB_CONN_MAX_LIFETIME=1h
10+
11+
# Redis Configuration (Optional but recommended for production)
12+
REDIS_ENABLED=true
13+
REDIS_ADDR=localhost:6379
14+
REDIS_PASSWORD=
15+
REDIS_DB=1
16+
REDIS_POOL_SIZE=10
17+
18+
# Admin API Configuration
19+
ADMIN_ENABLED=true
20+
ADMIN_LISTEN_ADDRESS=0.0.0.0:8081
21+
22+
# TLS/SSL Configuration
23+
TLS_ENABLED=false
24+
TLS_CERT_FILE=/etc/ssl/certs/router.crt
25+
TLS_KEY_FILE=/etc/ssl/private/router.key
26+
TLS_MIN_VERSION=1.2
27+
28+
# Authentication Configuration
29+
AUTH_JWT_SECRET=your-very-secure-random-secret-key-change-this-in-production
30+
AUTH_TOKEN_EXPIRY=1h
31+
AUTH_REFRESH_TOKEN_EXPIRY=168h
32+
AUTH_SESSION_EXPIRY=8h
33+
AUTH_BCRYPT_COST=12
34+
35+
# Initial User Configuration (for first-time setup)
36+
ADMIN_DEFAULT_USER=admin
37+
ADMIN_DEFAULT_PASSWORD=change-this-password
38+
ADMIN_DEFAULT_ROLE=super_admin
39+
40+
# CORS Configuration
41+
CORS_ALLOWED_ORIGINS=https://admin.example.com,https://app.example.com
42+
CORS_ALLOWED_METHODS=GET,POST,PUT,PATCH,DELETE,OPTIONS
43+
CORS_ALLOWED_HEADERS=Content-Type,Authorization,X-API-Key
44+
CORS_EXPOSED_HEADERS=X-RateLimit-*
45+
CORS_MAX_AGE=86400
46+
CORS_CREDENTIALS=true
47+
48+
# Content Security Policy
49+
CSP_DEFAULT_SRC='self'
50+
CSP_SCRIPT_SRC='self' 'unsafe-inline'
51+
CSP_STYLE_SRC='self' 'unsafe-inline'
52+
CSP_IMG_SRC='self' data:
53+
CSP_FONT_SRC='self'
54+
CSP_CONNECT_SRC='self'
55+
CSP_FRAME_ANCESTORS='none'
56+
CSP_FORM_ACTION='self'
57+
58+
# Rate Limiting Configuration
59+
RATE_LIMIT_ENABLED=true
60+
RATE_LIMIT_STORE=redis
61+
RATE_LIMIT_BURST_MULTIPLIER=3
62+
RATE_LIMIT_CLEANUP_INTERVAL=5m
63+
64+
# Security Headers
65+
SECURITY_X_CONTENT_TYPE_OPTIONS=nosniff
66+
SECURITY_X_FRAME_OPTIONS=DENY
67+
SECURITY_X_XSS_PROTECTION="1; mode=block"
68+
SECURITY_STRICT_TRANSPORT_SECURITY="max-age=31536000; includeSubDomains"
69+
70+
# Audit Logging Configuration
71+
AUDIT_ENABLED=true
72+
AUDIT_LOG_ALL_REQUESTS=false
73+
AUDIT_LOG_FAILED_AUTH=true
74+
AUDIT_LOG_ADMIN_ACTIONS=true
75+
AUDIT_RETENTION_DAYS=90
76+
77+
# User Management Configuration
78+
USERS_DEFAULT_AUTO_CREATED_ROLE=support
79+
USERS_PASSWORD_MIN_LENGTH=8
80+
USERS_PASSWORD_REQUIRE_UPPERCASE=true
81+
USERS_PASSWORD_REQUIRE_LOWERCASE=true
82+
USERS_PASSWORD_REQUIRE_NUMBERS=true
83+
USERS_PASSWORD_REQUIRE_SPECIAL=true
84+
USERS_PASSWORD_MAX_AGE_DAYS=90
85+
USERS_PASSWORD_PREVENT_REUSE=5
86+
87+
# Two-Factor Authentication Configuration
88+
TFA_ISSUER=Cortex
89+
TFA_BACKUP_CODES_COUNT=10
90+
TFA_BACKUP_CODE_LENGTH=8
91+
92+
# API Key Configuration
93+
API_KEYS_DEFAULT_ROLE=viewer
94+
API_KEYS_DEFAULT_EXPIRY=720h
95+
API_KEYS_MAX_EXPIRY=8760h
96+
API_KEYS_MAX_KEYS_PER_USER=50
97+
API_KEYS_AUTO_ROTATE=false
98+
API_KEYS_WARNING_DAYS=7
99+
100+
# Logging Configuration
101+
LOG_LEVEL=info
102+
LOG_FORMAT=json
103+
LOG_OUTPUT=stdout
104+
AUDIT_LOG_OUTPUT=/var/log/Cortex/audit.log
105+
106+
# Monitoring and Metrics
107+
METRICS_ENABLED=true
108+
METRICS_PORT=9090
109+
METRICS_PATH=/metrics
110+
111+
# Health Check Configuration
112+
HEALTH_ENABLED=true
113+
HEALTH_PORT=8080
114+
HEALTH_PATH=/health
115+
116+
# Production Security Settings (set these to true in production)
117+
PRODUCTION_SECURITY=false
118+
PRODUCTION_CORS_STRICT=false
119+
PRODUCTION_RATE_LIMIT_STRICT=false
120+
PRODUCTION_AUDIT_STRICT=false

.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# LLM Provider API Keys
2+
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxx
3+
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxx
4+
OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxxxxxxxxxxx
5+
6+
# Router API Key (for authenticating requests to the proxy)
7+
ROUTER_API_KEY=your-secure-api-key-here
8+
9+
# Optional: HTTP Proxy URL
10+
# PROXY_URL=http://proxy.example.com:8080

0 commit comments

Comments
 (0)