forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestInfluxDB.php
More file actions
53 lines (44 loc) · 1.12 KB
/
TestInfluxDB.php
File metadata and controls
53 lines (44 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace App\Console\Commands;
use App\Models\Result;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use InfluxDB2\Client;
use Symfony\Component\Yaml\Yaml;
class TestInfluxDB extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:test-influxdb';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Write a test log to InfluxDB to make sure the config works.';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
if (File::exists(base_path().'/config.yml')) {
$config = Yaml::parseFile(
base_path().'/config.yml'
);
}
if (File::exists('/app/config.yml')) {
$config = Yaml::parseFile('/app/config.yml');
}
$influxdb = $config['influxdb'];
if ($influxdb['enabled'] == true) {
$result = Result::factory()->create();
}
return 0;
}
}