Skip to content

Commit 7f7320f

Browse files
Deprecate not passing server base url and secret (#195)
* Deprecate not passing server base url and secret * Update src/BigBlueButton.php Co-authored-by: Felix Jacobi <felix@jacobi-hamburg.net> * Update src/BigBlueButton.php Co-authored-by: Felix Jacobi <felix@jacobi-hamburg.net> * Show deprecation when using environment variables --------- Co-authored-by: Felix Jacobi <felix@jacobi-hamburg.net>
1 parent 7e55854 commit 7f7320f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/BigBlueButton.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ class BigBlueButton
116116
*/
117117
public function __construct(?string $baseUrl = null, ?string $secret = null, ?TransportInterface $transport = null, string $hashingAlgorithm = HashingAlgorithm::SHA_1)
118118
{
119+
if (null === $baseUrl) {
120+
@trigger_error(sprintf('Constructing "%s" without passing a server base URL is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
121+
}
122+
123+
if (null === $secret) {
124+
@trigger_error(sprintf('Constructing "%s" without passing a secret is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
125+
}
126+
127+
if (getenv('BBB_SECURITY_SALT') !== false || getenv('BBB_SECRET') !== false) {
128+
@trigger_error('Using BBB_SECURITY_SALT or BBB_SECRET environment variables is deprecated for security reasons and will be removed in 6.0. Use the constructor parameters instead.', \E_USER_DEPRECATED);
129+
}
130+
131+
if (getenv('BBB_SERVER_BASE_URL') !== false) {
132+
@trigger_error('Using BBB_SERVER_BASE_URL environment variable is deprecated for security reasons and will be removed in 6.0. Use the constructor parameters instead.', \E_USER_DEPRECATED);
133+
}
134+
119135
// Keeping backward compatibility with older deployed versions
120136
$this->securitySecret = $secret ?: getenv('BBB_SECURITY_SALT') ?: getenv('BBB_SECRET');
121137
$this->bbbServerBaseUrl = $baseUrl ?: getenv('BBB_SERVER_BASE_URL');

0 commit comments

Comments
 (0)