Remove cred as arguments. #576

This commit is contained in:
Korina Cordero 2021-06-08 10:48:38 +00:00
parent 560db62a08
commit 8fa3551d47
6 changed files with 20 additions and 7 deletions

View file

@ -80,3 +80,7 @@ API_VERSION=insert_api_version_here
#SSL_ENABLE for websockets
SSL_ENABLE=set_to_true_or_false
# db
DB_USER=db_username
DB_PASSWORD=db_password

View file

@ -1,11 +1,13 @@
<?php
require_once(__DIR__ . '/../../vendor/autoload.php');
use Symfony\Component\Dotenv\Dotenv;
// load csv
$csv = fopen($argv[1], 'r');
$dsn = $argv[2];
$user = $argv[3];
$pass = $argv[4];
$output_file = $argv[5];
$output_file = $argv[3];
$output_fh = fopen($output_file, "w");
@ -17,6 +19,13 @@ if (!file_exists($argv[1]))
exit();
}
// get username and password
$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/../../.env');
$user = $_ENV['DB_USER'];
$pass = $_ENV['DB_PASSWORD'];
// connect to db
$db = new PDO($dsn, $user, $pass);

View file

@ -6,4 +6,4 @@ load_status_file="/tmp/warranty_load_status_$proc_date.txt"
echo $download_file
echo $load_status_file
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php $proc_date $download_file 1
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php $download_file "mysql:host=localhost;dbname=resq;charset=UTF8" root password $load_status_file
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php $download_file "mysql:host=localhost;dbname=resq;charset=UTF8" $load_status_file

View file

@ -37,4 +37,4 @@ touch /tmp/warranty_download_serial.csv
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-06-21 /tmp/warranty_download_serial.csv 0
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-07-21 /tmp/warranty_download_serial.csv 0
touch /tmp/warranty_load_status.txt
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php /tmp/warranty_download_serial.csv "mysql:host=localhost;dbname=resq;charset=UTF8" root password /tmp/warranty_load_status.txt
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php /tmp/warranty_download_serial.csv "mysql:host=localhost;dbname=resq;charset=UTF8" /tmp/warranty_load_status.txt

View file

@ -5,5 +5,5 @@ load_status_file="/tmp/warranty_load_status_$proc_date.txt"
#echo $download_file
#echo $load_status_file
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php $proc_date $download_file 1
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php $download_file "mysql:host=172.18.203.191:3306;dbname=resq;charset=UTF8" resq Motolite456 $load_status_file
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php $download_file "mysql:host=172.18.203.191:3306;dbname=resq;charset=UTF8" $load_status_file

View file

@ -37,4 +37,4 @@ touch /tmp/warranty_download_serial.csv
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-06-21 /tmp/warranty_download_serial.csv 0
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-07-21 /tmp/warranty_download_serial.csv 0
touch /tmp/warranty_load_status.txt
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php /tmp/warranty_download_serial.csv "mysql:host=172.18.203.191:3306;dbname=resq;charset=UTF8" resq Motolite456 /tmp/warranty_load_status.txt
/usr/bin/php /var/www/resq/utils/load_warranty_serial/load_serials.php /tmp/warranty_download_serial.csv "mysql:host=172.18.203.191:3306;dbname=resq;charset=UTF8" /tmp/warranty_load_status.txt