Fixes to ssl/tls, misc improvements
* Use the PHP context options to configure tls rather than reinventing the wheel. * Properly setup the SocketServer for ssl * Added generic getter for config values
This commit is contained in:
@ -41,6 +41,24 @@ class Configuration
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a key from the configuration. If the key ends with a dot, all values
|
||||
* with keys starting with the requested key are returned. If the key is a single
|
||||
* dot, all keys are matched and all values returned.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default Default value
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key, $default = null): mixed
|
||||
{
|
||||
if ($key === '.')
|
||||
return $this->config;
|
||||
if (str_ends_with($key, "."))
|
||||
return array_filter($this->config, fn($k)=>str_starts_with($k,$key), ARRAY_FILTER_USE_KEY);
|
||||
return $this->config[$key] ?? $default;
|
||||
}
|
||||
|
||||
public function setPublicUrl(string $publicUrl): self
|
||||
{
|
||||
$this->config['server.public_url'] = $publicUrl;
|
||||
|
Reference in New Issue
Block a user