Skip to content

Commit

Permalink
Add --no-api option to disable Torchlight at runtime, fix #53
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 3, 2022
1 parent 3d7ebc5 commit ba58216
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Commands/HydeBuildStaticSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Hyde\Framework\Models\MarkdownPost;
use Hyde\Framework\Services\CollectionService;
use Hyde\Framework\StaticPageBuilder;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use LaravelZero\Framework\Commands\Command;

Expand All @@ -33,7 +34,8 @@ class HydeBuildStaticSiteCommand extends Command
{--run-prod : Run the NPM prod script after build}
{--pretty : Should the build files be prettified?}
{--clean : Should the output directory be emptied before building?}
{--force : Allow file deletions when using --clean without confirmation?}';
{--force : Allow file deletions when using --clean without confirmation?}
{--no-api : Disable external API calls, such as Torchlight}';

/**
* The description of the command.
Expand All @@ -55,6 +57,13 @@ public function handle(): int

$this->title('Building your static site!');

if ($this->option('no-api')) {
$this->info('Disabling external API calls, such as Torchlight');
$config = config('hyde.features');
unset($config[array_search('torchlight', $config)]);
Config::set(['hyde.features' => $config]);
}

if ($this->option('clean')) {
if ($this->option('force')) {
$this->purge();
Expand Down

0 comments on commit ba58216

Please sign in to comment.