init
This commit is contained in:
@@ -9,32 +9,64 @@ use support\Db;
|
||||
class DatabaseConfig
|
||||
{
|
||||
public string $host = 'localhost' {
|
||||
get {
|
||||
return $this->host;
|
||||
}
|
||||
get => $this->host;
|
||||
}
|
||||
public string $username = 'root' {
|
||||
get {
|
||||
return $this->username;
|
||||
}
|
||||
get => $this->username;
|
||||
}
|
||||
public string $password = '' {
|
||||
get {
|
||||
return $this->password;
|
||||
}
|
||||
get => $this->password;
|
||||
}
|
||||
public string $database = 'opm_ectms' {
|
||||
get {
|
||||
return $this->database;
|
||||
}
|
||||
public string $database = 'ds2' {
|
||||
get => $this->database;
|
||||
}
|
||||
public int $port = 3306{
|
||||
get => $this->port;
|
||||
}
|
||||
|
||||
public string $charset = 'utf8mb4'{
|
||||
get => $this->charset;
|
||||
}
|
||||
//collation
|
||||
public string $collation = 'utf8mb4_general_ci'{
|
||||
get => $this->collation;
|
||||
}
|
||||
//driver
|
||||
public string $driver = 'mysql'{
|
||||
get => $this->driver;
|
||||
}
|
||||
|
||||
public int $max_connections = 5{
|
||||
get => $this->max_connections;
|
||||
}
|
||||
public int $min_connections = 1{
|
||||
get => $this->min_connections;
|
||||
}
|
||||
public int $wait_timeout = 3{
|
||||
get => $this->wait_timeout;
|
||||
}
|
||||
public int $idle_timeout = 60{
|
||||
get => $this->idle_timeout;
|
||||
}
|
||||
public int $heartbeat_interval = 50{
|
||||
get => $this->heartbeat_interval;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->host = getenv('DB_HOST');
|
||||
$this->username = getenv('DB_USER');
|
||||
$this->password = getenv('DB_PASSWORD');
|
||||
$this->database = getenv('DB_NAME');
|
||||
$this->host = getenv('DB_HOST', $this->host);
|
||||
$this->username = getenv('DB_USER', $this->username);
|
||||
$this->password = getenv('DB_PASSWORD', $this->password);
|
||||
$this->database = getenv('DB_NAME', $this->database);
|
||||
$this->port = getenv('DB_PORT', $this->port);
|
||||
$this->charset = getenv('DB_CHARSET', $this->charset);
|
||||
$this->collation = getenv('DB_COLLATION', $this->collation);
|
||||
$this->driver = getenv('DB_DRIVER', $this->driver);
|
||||
$this->max_connections = getenv('DB_MAX_CONNECTIONS', $this->max_connections);
|
||||
$this->min_connections = getenv('DB_MIN_CONNECTIONS', $this->min_connections);
|
||||
$this->wait_timeout = getenv('DB_WAIT_TIMEOUT', $this->wait_timeout);
|
||||
$this->idle_timeout = getenv('DB_IDLE_TIMEOUT', $this->idle_timeout);
|
||||
$this->heartbeat_interval = getenv('DB_HEARTBEAT_INTERVAL', $this->heartbeat_interval);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user