config command

Manage configuration settings for your ao-forge project.

Syntax

ao-forge config <subcommand> [options]

Subcommands

  • get - Get configuration value
  • set - Set configuration value
  • list - List all configuration
  • validate - Validate configuration
  • reset - Reset to defaults
  • show - Show configuration file
  • help - Show help information

get subcommand

Syntax

ao-forge config get <key> [options]

Examples

# Get specific value
ao-forge config get framework

# Get nested value
ao-forge config get ports.dev

# Get with default
ao-forge config get framework --default nextjs

set subcommand

Syntax

ao-forge config set <key> <value> [options]

Examples

# Set specific value
ao-forge config set framework nextjs

# Set nested value
ao-forge config set ports.dev 3001

# Set multiple values
ao-forge config set framework nextjs --set packageManager pnpm

list subcommand

Syntax

ao-forge config list [options]

Examples

# List all configuration
ao-forge config list

# List with format
ao-forge config list --format json
ao-forge config list --format yaml

# List specific section
ao-forge config list --section build

validate subcommand

Syntax

ao-forge config validate [options]

Examples

# Validate configuration
ao-forge config validate

# Validate with strict mode
ao-forge config validate --strict

# Validate specific file
ao-forge config validate --file ./config/custom.yml

reset subcommand

Syntax

ao-forge config reset [options]

Examples

# Reset to defaults
ao-forge config reset

# Reset specific section
ao-forge config reset --section build

# Reset with backup
ao-forge config reset --backup

show subcommand

Syntax

ao-forge config show [options]

Examples

# Show configuration file
ao-forge config show

# Show with format
ao-forge config show --format json
ao-forge config show --format yaml

# Show specific section
ao-forge config show --section deploy

Configuration Keys

Project Configuration

  • name - Project name
  • version - Project version
  • description - Project description
  • framework - Framework (nextjs, nuxtjs)
  • packageManager - Package manager (npm, pnpm, yarn)

AO Process Configuration

  • luaFiles - List of Lua files
  • autoStart - Auto-start processes
  • processName - Default process name
  • processes - Process configurations

Development Configuration

  • ports.dev - Development server port
  • ports.ao - AO process port
  • ports.monitoring - Monitoring port
  • debug - Debug mode
  • hotReload - Hot reloading

Build Configuration

  • build.output - Build output directory
  • build.optimize - Enable optimization
  • build.sourceMaps - Generate source maps
  • build.minify - Minify assets

Deployment Configuration

  • deploy.platform - Deployment platform
  • deploy.environment - Deployment environment
  • deploy.domain - Deployment domain
  • deploy.customDomain - Custom domain

Configuration Examples

Basic Configuration

# ao.config.yml
name: 'my-ao-app'
framework: 'nextjs'
packageManager: 'pnpm'
luaFiles: ['counter.lua']
autoStart: false
ports:
  dev: 3000

Advanced Configuration

# ao.config.yml
name: 'my-ao-app'
version: '1.0.0'
description: 'My AO-powered application'
framework: 'nextjs'
packageManager: 'pnpm'

# AO processes
luaFiles: ['counter.lua', 'token.lua']
autoStart: false
processName: 'my-process'

# Development
ports:
  dev: 3000
  ao: 8080
  monitoring: 9090

# Build
build:
  output: './dist'
  optimize: true
  sourceMaps: false

# Deployment
deploy:
  platform: 'vercel'
  environment: 'production'
  domain: 'my-app.vercel.app'

Configuration Validation

Validation Rules

# Validation rules
validation:
  required:
    - framework
    - packageManager
    - luaFiles
  optional:
    - ports
    - build
    - deploy
  types:
    framework: ['nextjs', 'nuxtjs']
    packageManager: ['npm', 'pnpm', 'yarn']

Validation Commands

# Validate configuration
ao-forge config validate

# Check for errors
ao-forge config validate --strict

# Fix configuration issues
ao-forge config fix

Environment-Specific Configuration

Development Configuration

# config/development.yml
ports:
  dev: 3000
debug: true
hotReload: true

Staging Configuration

# config/staging.yml
ports:
  dev: 3001
debug: false
hotReload: false

Production Configuration

# config/production.yml
ports:
  dev: 3000
debug: false
hotReload: false
build:
  optimize: true
  minify: true

Configuration Management

Using Environment Variables

# Set environment variables
export AO_FRAMEWORK=nextjs
export AO_PACKAGE_MANAGER=pnpm
export AO_PORT=3000

# Use in configuration
ao-forge config set framework $AO_FRAMEWORK
ao-forge config set packageManager $AO_PACKAGE_MANAGER
ao-forge config set ports.dev $AO_PORT

Configuration Templates

# Use configuration template
ao-forge config template nextjs

# Use custom template
ao-forge config template --file ./templates/custom.yml

Error Handling

Common Errors

  1. Configuration not found
    Error: Configuration file not found
    Solution: Run 'ao-forge config init' to create default configuration
    
  2. Invalid configuration
    Error: Invalid configuration value
    Solution: Use 'ao-forge config validate' to check for errors
    
  3. Configuration not applied
    Error: Configuration not applied
    Solution: Restart development server or reload configuration
    

Best Practices

Configuration Management

  1. Use version control for configuration files
  2. Document configuration options
  3. Validate configuration before deployment
  4. Use environment-specific configurations
  5. Keep secrets in environment variables

Security

  1. Never commit sensitive information
  2. Use environment variables for secrets
  3. Validate inputs in configuration
  4. Use secure defaults for production
  5. Regularly review configuration security