mirror of
https://github.com/fernwerker/ownDynDNS.git
synced 2025-07-17 00:35:43 +02:00
* rewrite the hole script:
** use .env file for config so we can retrieve updates ** add config and payload DTO with validators ** allow registrable domains as DynDNS ** update IPv4/6 only if changed (or really forced) ** remove obsolete failed_logins counter ** save logs with timestamp ** save only the newest 100 log entries for each domain
This commit is contained in:
parent
0c58ee7009
commit
05e326abe6
9 changed files with 528 additions and 149 deletions
122
src/Config.php
Normal file
122
src/Config.php
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
namespace netcup\DNS\API;
|
||||
|
||||
final class Config
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $apiKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $apiPassword;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $customerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $logFile;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $debug;
|
||||
|
||||
public function __construct(array $config)
|
||||
{
|
||||
foreach (get_object_vars($this) as $key => $val) {
|
||||
if (isset($config[$key])) {
|
||||
$this->$key = $config[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
return
|
||||
!empty($this->username) &&
|
||||
!empty($this->password) &&
|
||||
!empty($this->apiKey) &&
|
||||
!empty($this->apiPassword) &&
|
||||
!empty($this->customerId) &&
|
||||
!empty($this->logFile);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiKey()
|
||||
{
|
||||
return $this->apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiPassword()
|
||||
{
|
||||
return $this->apiPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCustomerId()
|
||||
{
|
||||
return $this->customerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogFile()
|
||||
{
|
||||
return $this->logFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
return $this->debug;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue