Skip to content

Fix cli correlation-id option not recognized#6

Merged
mdavid-dev merged 1 commit into
mainfrom
fix/cli_support_2
Feb 5, 2026
Merged

Fix cli correlation-id option not recognized#6
mdavid-dev merged 1 commit into
mainfrom
fix/cli_support_2

Conversation

@mdavid-dev

Copy link
Copy Markdown
Owner

Add CLI Integration with Environment Variable Support

Features

  • Environment variable CORRELATION_ID for passing correlation IDs to console commands
  • Automatic ID generation with configurable prefix (default: CLI-)
  • Security by default: Pattern validation /^[a-zA-Z0-9-_]+$/ blocks injection attacks
  • Process integration: Pass HTTP request IDs to CLI commands seamlessly

Configuration

correlation_id:
    validation:
        pattern: '/^[a-zA-Z0-9-_]+$/'  # Default: secure pattern
    cli:
        enabled: true
        prefix: 'CLI-'
        allow_env_var: true
Usage
# Auto-generated ID
php bin/console app:command
# → CLI-550e8400-e29b-41d4-a716-446655440000

# Custom ID via environment variable
CORRELATION_ID=custom-id-123 php bin/console app:command
# → custom-id-123

# From Process (main use case)
$process = new Process(
    ['php', 'bin/console', 'app:command'],
    env: ['CORRELATION_ID' => $this->correlationIdStorage->get()]
);

@mdavid-dev mdavid-dev merged commit a311acc into main Feb 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant