Add the name for the logs db to .env. Add parameter for logs db to services.yaml. #330

This commit is contained in:
Korina Cordero 2020-03-11 02:42:56 +00:00
parent 882a36f705
commit 29add2f078
3 changed files with 14 additions and 8 deletions

View file

@ -18,6 +18,11 @@ LOGGING_DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_logging
###< doctrine/doctrine-bundle ###
GMAPS_API_KEY=insert_gmapsapikey_here
# influxdb
INFLUXDB_HOST=127.0.0.1
INFLUXDB_PORT=8086
INFLUXDB_DB=logging_db
# rising tide sms gateway
RT_USER=rt_user
RT_PASS=rt_pass

View file

@ -12,6 +12,7 @@ parameters:
app_access_key: 'access_keys'
cvu_brand_id: "%env(CVU_BRAND_ID)%"
country_code: "%env(COUNTRY_CODE)%"
log_db: "%env(INFLUXDB_DB)%"
services:
# default configuration for services in *this* file
@ -22,12 +23,6 @@ services:
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# influxdb
InfluxDB\Client:
arguments: ['%env(INFLUXDB_HOST)%', '%env(INFLUXDB_PORT)%']
InfluxDB\Database:
arguments: ['%env(INFLUXDB_DB)%', "@InfluxDB\\Client"]
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
@ -227,6 +222,12 @@ services:
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing"
App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet"
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google"
# influxdb
InfluxDB\Client:
arguments: ['%env(INFLUXDB_HOST)%', '%env(INFLUXDB_PORT)%']
InfluxDB\Database:
arguments: ['%env(INFLUXDB_DB)%', "@InfluxDB\\Client"]
App\EventListener\JobOrderActiveCacheListener:
arguments:

View file

@ -503,8 +503,8 @@ class UserController extends Controller
public function getLogs(Client $client, $id)
{
// fetch database
// TODO: find way to replace hardcoded db name
$database = $client->selectDB('logging_db');
$log_db = $this->getParameter('log_db');
$database = $client->selectDB($log_db);
// query will return a resultset object
$query_string = 'SELECT * FROM entity_log WHERE "user" = ' . $id;