Files
michaelschiemer/src/Framework/Vite/ValueObjects/ViteConfig.php
Michael Schiemer fc3d7e6357 feat(Production): Complete production deployment infrastructure
- Add comprehensive health check system with multiple endpoints
- Add Prometheus metrics endpoint
- Add production logging configurations (5 strategies)
- Add complete deployment documentation suite:
  * QUICKSTART.md - 30-minute deployment guide
  * DEPLOYMENT_CHECKLIST.md - Printable verification checklist
  * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle
  * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference
  * production-logging.md - Logging configuration guide
  * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation
  * README.md - Navigation hub
  * DEPLOYMENT_SUMMARY.md - Executive summary
- Add deployment scripts and automation
- Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment
- Update README with production-ready features

All production infrastructure is now complete and ready for deployment.
2025-10-25 19:18:37 +02:00

89 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Vite\ValueObjects;
/**
* Value Object for Vite configuration
*
* Holds configuration for Vite integration including paths,
* dev server settings, and entrypoint configuration.
*/
final readonly class ViteConfig
{
/**
* @param string $buildDirectory Directory where Vite outputs files (relative to public/)
* @param string $manifestFileName Name of the manifest file
* @param string $devServerUrl URL of the Vite dev server
* @param array<string> $entrypoints Default entrypoints to load
* @param string|null $nonce CSP nonce for inline scripts
* @param bool $hotReload Whether to enable hot module replacement in dev
*/
public function __construct(
public string $buildDirectory = 'assets',
public string $manifestFileName = '.vite/manifest.json',
public string $devServerUrl = 'https://localhost:3000',
public array $entrypoints = ['main'],
public ?string $nonce = null,
public bool $hotReload = true
) {
}
/**
* Get the full manifest path relative to public directory
*/
public function getManifestPath(string $publicPath): string
{
return rtrim($publicPath, '/') . '/' . ltrim($this->manifestFileName, '/');
}
/**
* Get the dev server entry URL
*/
public function getDevServerEntry(string $entry): string
{
return rtrim($this->devServerUrl, '/') . '/' . ltrim($entry, '/');
}
/**
* Get the Vite client URL for HMR
*/
public function getViteClientUrl(): string
{
return rtrim($this->devServerUrl, '/') . '/@vite/client';
}
/**
* Create config with custom entrypoints
*
* @param array<string> $entrypoints
*/
public function withEntrypoints(array $entrypoints): self
{
return new self(
buildDirectory: $this->buildDirectory,
manifestFileName: $this->manifestFileName,
devServerUrl: $this->devServerUrl,
entrypoints: $entrypoints,
nonce: $this->nonce,
hotReload: $this->hotReload
);
}
/**
* Create config with CSP nonce
*/
public function withNonce(string $nonce): self
{
return new self(
buildDirectory: $this->buildDirectory,
manifestFileName: $this->manifestFileName,
devServerUrl: $this->devServerUrl,
entrypoints: $this->entrypoints,
nonce: $nonce,
hotReload: $this->hotReload
);
}
}