Skip to content

Configuration Management

dev-mondoshawan edited this page Apr 16, 2026 · 2 revisions

Configuration Management

**Referenced Files in This Document** - [backend/src/config/index.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/config/index.js) - [backend/.env.example](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/.env.example) - [frontend/.env.example](https://github.com/RunTimeAdmin/AgentID/blob/main/frontend/.env.example) - [backend/package.json](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/package.json) - [frontend/package.json](https://github.com/RunTimeAdmin/AgentID/blob/main/frontend/package.json)

Table of Contents

  1. Introduction
  2. Environment Variables
  3. Backend Configuration
  4. Frontend Configuration
  5. Security Considerations
  6. Deployment Configuration

Introduction

AgentID uses environment-based configuration management to handle different deployment environments (development, staging, production). Configuration is centralized in the backend config module and loaded from environment variables.

Environment Variables

Required Variables

Variable Description Example
DATABASE_URL PostgreSQL connection string postgresql://user:pass@localhost:5432/agentid
REDIS_URL Redis connection string redis://localhost:6379
BAGS_API_KEY API key for Bags integration bags_api_key_xxx
SAID_GATEWAY_URL SAID Identity Gateway endpoint https://said.example.com
AGENTID_BASE_URL Public base URL for the service https://agentid.provenanceai.network

Optional Variables

Variable Description Default
PORT Server port 3002
NODE_ENV Environment mode development
CORS_ORIGIN Allowed CORS origin *
BADGE_CACHE_TTL Badge cache TTL (seconds) 60
CHALLENGE_EXPIRY_SECONDS Challenge expiration (seconds) 300

Backend Configuration

The backend configuration module (backend/src/config/index.js) centralizes all environment variables:

module.exports = {
  port: process.env.PORT || 3002,
  nodeEnv: process.env.NODE_ENV || 'development',
  databaseUrl: process.env.DATABASE_URL,
  redisUrl: process.env.REDIS_URL,
  bagsApiKey: process.env.BAGS_API_KEY,
  saidGatewayUrl: process.env.SAID_GATEWAY_URL,
  baseUrl: process.env.AGENTID_BASE_URL,
  corsOrigin: process.env.CORS_ORIGIN || '*',
  badgeCacheTtl: parseInt(process.env.BADGE_CACHE_TTL) || 60,
  challengeExpirySeconds: parseInt(process.env.CHALLENGE_EXPIRY_SECONDS) || 300
};

Frontend Configuration

Frontend configuration is handled through Vite's environment variable system:

  • VITE_API_BASE_URL: Backend API base URL
  • VITE_WIDGET_BASE_URL: Widget serving base URL

Security Considerations

  • Never commit .env files to version control
  • Use strong, unique API keys for production
  • Enable SSL/TLS for all external connections
  • Use secrets management in production (e.g., AWS Secrets Manager, HashiCorp Vault)

Deployment Configuration

Docker Environment

When running in Docker, pass environment variables via:

  • Docker Compose environment section
  • Docker secrets for sensitive values
  • Kubernetes ConfigMaps and Secrets

Production Checklist

  • All required environment variables are set
  • Database and Redis connections use SSL
  • CORS origin is restricted to known domains
  • Rate limiting is enabled
  • Debug logging is disabled

Clone this wiki locally