Conduct

Configuration

Profile Management

Conduct CLI uses profiles to manage multiple backend environments. Each profile stores:

  • Backend URL
  • API key
  • Project identifier
  • Active status

Configuration File

Profiles are stored in ~/.conduct/credentials.json:

{
  "profiles": {
    "local": {
      "url": "http://localhost:3000/conduct",
      "apiKey": "sk_admin_xxx",
      "project": "myproject"
    },
    "staging": {
      "url": "https://staging.example.com/conduct",
      "apiKey": "sk_staging_xxx",
      "project": "myproject"
    },
    "production": {
      "url": "https://api.example.com/conduct",
      "apiKey": "sk_prod_xxx",
      "project": "myproject"
    }
  },
  "activeProfile": "local"
}

Managing Profiles

Add Profile

conduct profile add \
  --name <profile-name> \
  --url <backend-url> \
  --key <api-key> \
  --project <project-id>

Example:

conduct profile add \
  --name local \
  --url http://localhost:3000/conduct \
  --key sk_admin_abc123 \
  --project myproject

List Profiles

conduct profile list

Output:

Available profiles:
* local (http://localhost:3000/conduct) - myproject
  staging (https://staging.example.com/conduct) - myproject
  production (https://api.example.com/conduct) - myproject

* = active profile

Switch Profile

conduct profile use <profile-name>

Example:

conduct profile use staging

Remove Profile

conduct profile remove <profile-name>

With confirmation:

conduct profile remove production

Skip confirmation:

conduct profile remove production --force

Test Profile

Verify connectivity:

conduct profile test

Test specific profile:

conduct profile test --profile production

Environment-Specific Setup

Local Development

conduct profile add \
  --name local \
  --url http://localhost:3000/conduct \
  --key sk_dev_xxx \
  --project myproject

Staging

conduct profile add \
  --name staging \
  --url https://staging.company.com/conduct \
  --key sk_staging_xxx \
  --project myproject

Production

For production, use read-only keys:

conduct profile add \
  --name production \
  --url https://api.company.com/conduct \
  --key sk_prod_readonly_xxx \
  --project myproject

Using Profiles

Explicit Profile Selection

Override active profile for a single command:

conduct spec list --profile staging

Switching Profiles

Change active profile:

conduct profile use staging
conduct spec list  # Uses staging
 
conduct profile use local
conduct spec list  # Uses local

Backend Configuration

Environment Variables

Backend configuration via .env:

# Server
PORT=3000
NODE_ENV=production
BASE_URL=/conduct
 
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/conduct
 
# Storage
STORAGE_TYPE=local
STORAGE_PATH=./storage
 
# Auth
API_KEY_PREFIX=sk_
 
# Rate Limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=60000

Configuration File

Alternative configuration via config.json:

{
  "server": {
    "port": 3000,
    "baseUrl": "/conduct"
  },
  "database": {
    "type": "postgres",
    "url": "postgresql://..."
  },
  "storage": {
    "type": "local",
    "path": "./storage"
  },
  "rateLimit": {
    "enabled": true,
    "max": 100,
    "windowMs": 60000
  }
}

CLI Cache Configuration

The CLI caches responses for better performance.

Cache Location

~/.conduct/cache/

Cache Settings

Default TTL (Time To Live):

  • Specs: 5 minutes
  • Runs: 5 minutes
  • Checks: 5 minutes
  • Features: 10 minutes

Clear Cache

conduct cache clear

Clear specific types:

conduct cache clear --type specs
conduct cache clear --type runs

Project Configuration

Each project can have local configuration in _conduct/config.json:

{
  "defaultProfile": "local",
  "autoSync": true,
  "syncInterval": 300000
}

API Key Permissions

API keys have different permission levels:

Admin

Full access to all operations:

{
  "permissions": ["read", "write", "delete", "admin"]
}

Read-Write

Standard development key:

{
  "permissions": ["read", "write"]
}

Read-Only

Safe for CI/CD and reporting:

{
  "permissions": ["read"]
}

Security Best Practices

  1. Never commit credentials - Add ~/.conduct to .gitignore
  2. Use environment-specific keys - Different keys for dev/staging/prod
  3. Rotate keys regularly - Generate new keys periodically
  4. Limit permissions - Use read-only keys when possible
  5. Secure storage - Keep credentials.json file permissions restricted
chmod 600 ~/.conduct/credentials.json

Next Steps