From 10137a602ab134637d56737a5caa930383ba85e1 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 13 Dec 2020 16:26:54 +0000 Subject: [PATCH 1/3] Load integrations config with db data --- app/Providers/IntegrationsServiceProvider.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Providers/IntegrationsServiceProvider.php b/app/Providers/IntegrationsServiceProvider.php index e896ef13..3ec0d2ca 100644 --- a/app/Providers/IntegrationsServiceProvider.php +++ b/app/Providers/IntegrationsServiceProvider.php @@ -35,18 +35,30 @@ class IntegrationsServiceProvider extends ServiceProvider */ public function boot() { - if(File::exists(env('DB_DATABASE'))) { - if(Schema::hasTable('settings')) { + if (File::exists(env('DB_DATABASE'))) { + if (Schema::hasTable('settings')) { $setting = SettingsHelper::get('healthchecks_uuid'); - if($setting !== false) { + if ($setting !== false) { try { - App::bind('healthcheck', function() use ($setting) { + // Update config with DB values + config([ + 'integrations' => [ + 'healthchecks_enabled' => SettingsHelper::get('healthchecks_enabled')->value, + 'healthchecks_uuid' => SettingsHelper::get('healthchecks_uuid')->value, + 'healthchecks_uuid' => SettingsHelper::get('healthchecks_uuid')->value, + 'slack_webhook' => SettingsHelper::get('slack_webhook')->value, + 'telegram_bot_token' => SettingsHelper::get('telegram_bot_token')->value, + 'telegram_chat_id' => SettingsHelper::get('telegram_chat_id')->value, + ] + ]); + + App::bind('healthcheck', function () use ($setting) { return new Healthchecks($setting->value); }); - } catch(InvalidUuidStringException $e) { + } catch (InvalidUuidStringException $e) { Log::error('Invalid healthchecks UUID'); - } catch(Exception $e) { + } catch (Exception $e) { Log::error($e->getMessage()); } } From e9de226c7aced79e9719751ffcd55a708d663a63 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 13 Dec 2020 16:26:54 +0000 Subject: [PATCH 2/3] Revert "Load integrations config with db data" This reverts commit 10137a602ab134637d56737a5caa930383ba85e1. --- app/Providers/IntegrationsServiceProvider.php | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/app/Providers/IntegrationsServiceProvider.php b/app/Providers/IntegrationsServiceProvider.php index 3ec0d2ca..e896ef13 100644 --- a/app/Providers/IntegrationsServiceProvider.php +++ b/app/Providers/IntegrationsServiceProvider.php @@ -35,30 +35,18 @@ class IntegrationsServiceProvider extends ServiceProvider */ public function boot() { - if (File::exists(env('DB_DATABASE'))) { - if (Schema::hasTable('settings')) { + if(File::exists(env('DB_DATABASE'))) { + if(Schema::hasTable('settings')) { $setting = SettingsHelper::get('healthchecks_uuid'); - if ($setting !== false) { + if($setting !== false) { try { - // Update config with DB values - config([ - 'integrations' => [ - 'healthchecks_enabled' => SettingsHelper::get('healthchecks_enabled')->value, - 'healthchecks_uuid' => SettingsHelper::get('healthchecks_uuid')->value, - 'healthchecks_uuid' => SettingsHelper::get('healthchecks_uuid')->value, - 'slack_webhook' => SettingsHelper::get('slack_webhook')->value, - 'telegram_bot_token' => SettingsHelper::get('telegram_bot_token')->value, - 'telegram_chat_id' => SettingsHelper::get('telegram_chat_id')->value, - ] - ]); - - App::bind('healthcheck', function () use ($setting) { + App::bind('healthcheck', function() use ($setting) { return new Healthchecks($setting->value); }); - } catch (InvalidUuidStringException $e) { + } catch(InvalidUuidStringException $e) { Log::error('Invalid healthchecks UUID'); - } catch (Exception $e) { + } catch(Exception $e) { Log::error($e->getMessage()); } } From 0910bbb75742d21b4bb97a887712606e91a4bf91 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 13 Dec 2020 16:29:05 +0000 Subject: [PATCH 3/3] Fixed integrations config being empty --- README.md | 2 +- app/Providers/IntegrationsServiceProvider.php | 14 ++++++++------ changelog.json | 6 ++++++ config/speedtest.php | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index af842b51..187eba98 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Speedtest Tracker -[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Stable?label=master&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Dev?label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.10.0-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE) +[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Stable?label=master&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Dev?label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.10.1-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE) This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results. diff --git a/app/Providers/IntegrationsServiceProvider.php b/app/Providers/IntegrationsServiceProvider.php index e896ef13..94a91825 100644 --- a/app/Providers/IntegrationsServiceProvider.php +++ b/app/Providers/IntegrationsServiceProvider.php @@ -35,18 +35,20 @@ class IntegrationsServiceProvider extends ServiceProvider */ public function boot() { - if(File::exists(env('DB_DATABASE'))) { - if(Schema::hasTable('settings')) { + if (File::exists(env('DB_DATABASE'))) { + if (Schema::hasTable('settings')) { $setting = SettingsHelper::get('healthchecks_uuid'); - if($setting !== false) { + if ($setting !== false) { try { - App::bind('healthcheck', function() use ($setting) { + SettingsHelper::loadIntegrationConfig(); + + App::bind('healthcheck', function () use ($setting) { return new Healthchecks($setting->value); }); - } catch(InvalidUuidStringException $e) { + } catch (InvalidUuidStringException $e) { Log::error('Invalid healthchecks UUID'); - } catch(Exception $e) { + } catch (Exception $e) { Log::error($e->getMessage()); } } diff --git a/changelog.json b/changelog.json index a4477778..abb384cb 100644 --- a/changelog.json +++ b/changelog.json @@ -1,4 +1,10 @@ { + "1.10.1": [ + { + "description": "Fixed integrations config being empty causing healthchecks to not run on scheduled tests.", + "link": "" + } + ], "1.10.0": [ { "description": "Added automated build for ARM.", diff --git a/config/speedtest.php b/config/speedtest.php index efa39079..8af25314 100644 --- a/config/speedtest.php +++ b/config/speedtest.php @@ -7,7 +7,7 @@ return [ |-------------------------------------------------------------------------- */ - 'version' => '1.10.0', + 'version' => '1.10.1', /* |--------------------------------------------------------------------------