Files
expose/app/Commands/ShareCommand.php
Marcel Pociot 81d8311995 wip
2020-04-17 16:46:15 +02:00

32 lines
959 B
PHP

<?php
namespace App\Commands;
use App\Client\Factory;
use Illuminate\Console\Scheduling\Schedule;
use LaravelZero\Framework\Commands\Command;
use React\EventLoop\LoopInterface;
class ShareCommand extends Command
{
protected $signature = 'share {host} {--subdomain=} {--auth=}';
protected $description = 'Share a local url with a remote shaft server';
public function handle()
{
// TODO: Hacky workaround just to see if it works haha
if ($this->option('auth')) {
$GLOBALS['expose.auth'] = $this->option('auth');
}
(new Factory())
->setLoop(app(LoopInterface::class))
// ->setHost('beyond.sh') // TODO: Read from (local/global) config file
// ->setPort(8080) // TODO: Read from (local/global) config file
->createClient($this->argument('host'), explode(',', $this->option('subdomain')))
->createHttpServer()
->run();
}
}