mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
feat: Config option to set default protocol to https (#110)
* feat: Config option to set default protocol to https * style: Fix for StyleCI
This commit is contained in:
@@ -59,14 +59,19 @@ class ShareCurrentWorkingDirectoryCommand extends ShareCommand
|
|||||||
return str_replace('.', '-', basename($projectPath));
|
return str_replace('.', '-', basename($projectPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareSharedHost($host): string
|
protected function detectProtocol($host): string
|
||||||
{
|
{
|
||||||
$certificateFile = ($_SERVER['HOME'] ?? $_SERVER['USERPROFILE']).DIRECTORY_SEPARATOR.'.config'.DIRECTORY_SEPARATOR.'valet'.DIRECTORY_SEPARATOR.'Certificates'.DIRECTORY_SEPARATOR.$host.'.crt';
|
$certificateFile = ($_SERVER['HOME'] ?? $_SERVER['USERPROFILE']).DIRECTORY_SEPARATOR.'.config'.DIRECTORY_SEPARATOR.'valet'.DIRECTORY_SEPARATOR.'Certificates'.DIRECTORY_SEPARATOR.$host.'.crt';
|
||||||
|
|
||||||
if (file_exists($certificateFile)) {
|
if (file_exists($certificateFile)) {
|
||||||
return 'https://'.$host;
|
return 'https://';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $host;
|
return config('expose.default_https', false) ? 'https://' : 'http://';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function prepareSharedHost($host): string
|
||||||
|
{
|
||||||
|
return $this->detectProtocol($host).$host;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,18 @@ return [
|
|||||||
*/
|
*/
|
||||||
'default_tld' => 'test',
|
'default_tld' => 'test',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default HTTPS
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Whether to use HTTPS as a default when sharing your local sites. Expose
|
||||||
|
| will try to look up the protocol if you are using Laravel Valet
|
||||||
|
| automatically. Otherwise you can specify it here manually.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'default_https' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Maximum Logged Requests
|
| Maximum Logged Requests
|
||||||
|
|||||||
Reference in New Issue
Block a user