Allow specifying a hash key in the config rather than a path for Sharp Chat authentication.
This commit is contained in:
parent
f2fd3ff66f
commit
3dafc519d8
1 changed files with 9 additions and 3 deletions
|
@ -17,9 +17,15 @@ final class SharpChatRoutes {
|
|||
private string $hashKey = 'woomy';
|
||||
|
||||
public function __construct(MszContext $ctx) {
|
||||
$hashKeyPath = Config::get('sockChat.hashKeyPath', Config::TYPE_STR, '');
|
||||
if(is_file($hashKeyPath))
|
||||
$this->hashKey = file_get_contents($hashKeyPath);
|
||||
$hashKey = Config::get('sockChat.hashKey', Config::TYPE_STR, '');
|
||||
|
||||
if(empty($hashKey)) {
|
||||
$hashKeyPath = Config::get('sockChat.hashKeyPath', Config::TYPE_STR, '');
|
||||
if(is_file($hashKeyPath))
|
||||
$this->hashKey = file_get_contents($hashKeyPath);
|
||||
} else {
|
||||
$this->hashKey = $hashKey;
|
||||
}
|
||||
|
||||
$router = $ctx->getRouter();
|
||||
|
||||
|
|
Loading…
Reference in a new issue