diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index 002ed78436f..166ea34e4ac 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -30,6 +30,7 @@ class ServeCommand extends ValidatingCommand {--port= : [default: 8080]} {--dashboard= : Enable the realtime compiler dashboard. (Overrides config setting)} {--pretty-urls= : Enable pretty URLs. (Overrides config setting)} + {--play-cdn= : Enable the Tailwind Play CDN. (Overrides config setting)} '; /** @var string */ @@ -77,6 +78,7 @@ protected function getEnvironmentVariables(): array 'HYDE_SERVER_REQUEST_OUTPUT' => ! $this->option('no-ansi'), 'HYDE_SERVER_DASHBOARD' => $this->parseEnvironmentOption('dashboard'), 'HYDE_PRETTY_URLS' => $this->parseEnvironmentOption('pretty-urls'), + 'HYDE_PLAY_CDN' => $this->parseEnvironmentOption('play-cdn'), ]); } diff --git a/packages/framework/src/Foundation/Internal/LoadConfiguration.php b/packages/framework/src/Foundation/Internal/LoadConfiguration.php index 3079c9258a8..5fa364ee040 100644 --- a/packages/framework/src/Foundation/Internal/LoadConfiguration.php +++ b/packages/framework/src/Foundation/Internal/LoadConfiguration.php @@ -89,6 +89,7 @@ private function loadRuntimeConfiguration(Application $app, Repository $reposito $this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_SERVER_DASHBOARD', 'hyde.server.dashboard.enabled'); $this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_PRETTY_URLS', 'hyde.pretty_urls'); + $this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_PLAY_CDN', 'hyde.use_play_cdn'); } } diff --git a/packages/framework/tests/Unit/ServeCommandOptionsUnitTest.php b/packages/framework/tests/Unit/ServeCommandOptionsUnitTest.php index bd2c959d02a..605d24ecc81 100644 --- a/packages/framework/tests/Unit/ServeCommandOptionsUnitTest.php +++ b/packages/framework/tests/Unit/ServeCommandOptionsUnitTest.php @@ -116,6 +116,24 @@ public function testPrettyUrlsOptionPropagatesToEnvironmentVariables() $this->assertFalse(isset($command->getEnvironmentVariables()['HYDE_PRETTY_URLS'])); } + public function testPlayCdnOptionPropagatesToEnvironmentVariables() + { + $command = $this->getMock(['play-cdn' => 'false']); + $this->assertSame('disabled', $command->getEnvironmentVariables()['HYDE_PLAY_CDN']); + + $command = $this->getMock(['play-cdn' => 'true']); + $this->assertSame('enabled', $command->getEnvironmentVariables()['HYDE_PLAY_CDN']); + + $command = $this->getMock(['play-cdn' => '']); + $this->assertSame('enabled', $command->getEnvironmentVariables()['HYDE_PLAY_CDN']); + + $command = $this->getMock(['play-cdn' => null]); + $this->assertFalse(isset($command->getEnvironmentVariables()['HYDE_PLAY_CDN'])); + + $command = $this->getMock(); + $this->assertFalse(isset($command->getEnvironmentVariables()['HYDE_PLAY_CDN'])); + } + public function test_parseEnvironmentOption() { $command = $this->getMock(['foo' => 'true']);