Environment Variables
Vestauth server configuration is managed through environment variables stored in a.env file. Run vestauth server init to create this file automatically.
PORT
The port the server listens on.- Default:
3000 - Type: String or Number
- Example:
"3000"or"8080"
.env
HOSTNAME
The full URL where your Vestauth server is accessible. This is critical for agent registration and discovery.- Default:
http://localhost:3000 - Type: String (URL)
- Local development:
http://localhost:3000 - Production:
https://vestauth.yoursite.com
.env (Development)
.env (Production)
DATABASE_URL
PostgreSQL connection string.- Default:
postgres://localhost/vestauth_production - Type: String (PostgreSQL connection URL)
- Format:
postgresql://[user[:password]@][host][:port][/dbname][?param1=value1&...]
.env (Local PostgreSQL)
.env (Managed PostgreSQL)
The database URL is used by:
vestauth server db:create- Creates the databasevestauth server db:migrate- Runs migrationsvestauth server start- Connects to the database
Configuration File
The.env file is created in your current directory when you run vestauth server init. Here’s a complete example:
.env
Wildcard DNS Requirements
Vestauth uses subdomain-based routing to serve agent public keys. Each agent gets a unique subdomain:Example DNS Configuration
If yourHOSTNAME=https://vestauth.yourapp.com, configure:
Local Development
For local development withlocalhost, wildcard DNS works automatically:
Testing Wildcard DNS
Verify your wildcard DNS is working:Production Configuration Checklist
1
Update HOSTNAME
Change from
http://localhost:3000 to your production domain:2
Configure Wildcard DNS
Add DNS record for
*.vestauth.yoursite.com pointing to your server.3
Use Managed PostgreSQL
Update DATABASE_URL to a production database:
4
Set Up HTTPS
Configure SSL/TLS using:
- Let’s Encrypt with Caddy (automatic HTTPS)
- Nginx with certbot
- Cloudflare proxy
- Load balancer SSL termination
5
Configure Reverse Proxy
Set up nginx or Caddy to forward requests to your server port:
nginx.conf
Environment Variable Precedence
Vestauth resolves configuration in this order:-
Command-line flags (highest priority)
-
.env file
-
Default values (lowest priority)
- PORT:
3000 - HOSTNAME:
http://localhost:3000 - DATABASE_URL:
postgres://localhost/vestauth_production
- PORT:
Security Considerations
Database Security
- Use strong passwords for PostgreSQL
- Enable SSL for database connections in production
- Restrict database access to your server’s IP
- Use read-only credentials where possible
Network Security
- Always use HTTPS in production (not HTTP)
- Configure firewall rules to restrict access
- Use a reverse proxy (nginx, Caddy) for SSL termination
- Enable rate limiting to prevent abuse
Advanced Configuration
For advanced configuration options, you can modify the server code directly:- Server implementation:
src/server/index.js - Database models:
src/server/models/ - Express middleware:
src/server/index.js(lines 23-61)