feat: add option to use secrets JSON file instead
This commit is contained in:
parent
f02e6b3168
commit
4baa737d95
2 changed files with 13 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
||||||
|
/www/secrets
|
||||||
|
sftp.json
|
|
@ -7,8 +7,16 @@ class MySQLAdapter {
|
||||||
public $data_directory;
|
public $data_directory;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->raw = mysqli_connect(getenv('MYSQL_HOST'),
|
$db_params = json_decode(file_get_contents('secrets/db.json'), true);
|
||||||
getenv('MYSQL_USER'), getenv('MYSQL_PASSWORD'), getenv('MYSQL_DATABASE'));
|
|
||||||
|
if(null !== getenv('MYSQL_HOST')) {
|
||||||
|
$this->raw = mysqli_connect(getenv('MYSQL_HOST'),
|
||||||
|
getenv('MYSQL_USER'), getenv('MYSQL_PASSWORD'), getenv('MYSQL_DATABASE'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->raw = mysqli_connect($db_params['MYSQL_HOST'],
|
||||||
|
$db_params['MYSQL_USER'], $db_params['MYSQL_PASSWORD'], $db_params['MYSQL_DATABASE']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->data_directory = 'raw';
|
$this->data_directory = 'raw';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue