mirror of
https://codeberg.org/vlw/scaffold.git
synced 2026-02-26 11:31:57 +01:00
fix: set Database env credentials without returning a new instance (#24)
This is a follow-up PR from #22. Instead of returning a new instance after setting the environment variables we simply do nothing. Most of the extending classes will not take advantage of the new instance anyways, and will just call `new Database()` as before. Of course, as mentioned in #22 this setup is not ideal, and another solution should be implemented to instance this class. Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/24
This commit is contained in:
parent
1536079fe3
commit
f4b8f8673e
1 changed files with 2 additions and 4 deletions
|
|
@ -26,9 +26,9 @@
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $database
|
* @param string $database
|
||||||
* @return static
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function from_credentials(
|
public static function set_credentials(
|
||||||
?string $host = self::DEFAULT_HOSTNAME,
|
?string $host = self::DEFAULT_HOSTNAME,
|
||||||
?string $username = self::DEFAULT_USERNAME,
|
?string $username = self::DEFAULT_USERNAME,
|
||||||
?string $password = self::DEFAULT_PASSWORD,
|
?string $password = self::DEFAULT_PASSWORD,
|
||||||
|
|
@ -44,8 +44,6 @@
|
||||||
$_ENV["mariadb"]["user"] = $username;
|
$_ENV["mariadb"]["user"] = $username;
|
||||||
$_ENV["mariadb"]["pass"] = $password;
|
$_ENV["mariadb"]["pass"] = $password;
|
||||||
$_ENV["mariadb"]["db"] = $database;
|
$_ENV["mariadb"]["db"] = $database;
|
||||||
|
|
||||||
return new static();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue