init ci
This commit is contained in:
commit
1f81c383eb
2 files changed
+98
No files matched your search
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class Config {
|
||||
private const NEXTCLOUD_BASE_URL = "NCBGW_BASE_URL";
|
||||
private const SECRET = "NCBGW_SECRET";
|
||||
private const BASIC_AUTH_USERNAME = 'NCBGW_USERNAME';
|
||||
private const BASIC_AUTH_PASSWORD = 'NCBGW_PASSWORD';
|
||||
|
||||
private $nextCloudBaseUrl;
|
||||
private $secret;
|
||||
private $username;
|
||||
private $password;
|
||||
|
||||
function __construct($config) {
|
||||
$this->nextCloudBaseUrl = $this->getRequired($config, Config::NEXTCLOUD_BASE_URL);
|
||||
$this->secret = $this->getRequired($config, Config::SECRET);
|
||||
$this->username = $this->getRequired($config, Config::BASIC_AUTH_USERNAME);
|
||||
$this->password = $this->getRequired($config, Config::BASIC_AUTH_PASSWORD);
|
||||
}
|
||||
|
||||
private function getRequired($config, $key) {
|
||||
if (array_key_exists($key, $config)) {
|
||||
return $config[$key];
|
||||
} else {
|
||||
throw new Exception("missing configuration " . $key);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSecret() {
|
||||
return $this->secret;
|
||||
}
|
||||
|
||||
public function getUrl() {
|
||||
return $this->nextCloudBaseUrl . '/ocs/v2.php/apps/spreed/api/v1';
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getPassword() {
|
||||
return $this->password;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user