Replace config.yml with settings UI (#58)

This commit is contained in:
Alex Justesen
2022-10-21 09:49:32 -04:00
committed by GitHub
parent 195142c590
commit 58c160e270
20 changed files with 1098 additions and 271 deletions
-1
View File
@@ -16,7 +16,6 @@ _ide_helper.php
.env.backup
.phpstorm.meta.php
.phpunit.result.cache
config.yml
auth.json
docker-compose.yml
Homestead.json
+1 -1
View File
@@ -4,7 +4,7 @@
/public/storage
/storage/*.key
/vendor
config.yml
.env
.env.backup
.phpunit.result.cache
+66
View File
@@ -11,6 +11,8 @@ namespace PHPSTORM_META {
*/
override(new \Illuminate\Contracts\Container\Container, map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -148,6 +150,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -198,6 +204,8 @@ namespace PHPSTORM_META {
]));
override(\Illuminate\Container\Container::makeWith(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -335,6 +343,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -385,6 +397,8 @@ namespace PHPSTORM_META {
]));
override(\Illuminate\Contracts\Container\Container::get(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -522,6 +536,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -572,6 +590,8 @@ namespace PHPSTORM_META {
]));
override(\Illuminate\Contracts\Container\Container::make(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -709,6 +729,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -759,6 +783,8 @@ namespace PHPSTORM_META {
]));
override(\Illuminate\Contracts\Container\Container::makeWith(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -896,6 +922,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -946,6 +976,8 @@ namespace PHPSTORM_META {
]));
override(\App::get(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -1083,6 +1115,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -1133,6 +1169,8 @@ namespace PHPSTORM_META {
]));
override(\App::make(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -1270,6 +1308,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -1320,6 +1362,8 @@ namespace PHPSTORM_META {
]));
override(\App::makeWith(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -1457,6 +1501,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -1507,6 +1555,8 @@ namespace PHPSTORM_META {
]));
override(\app(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -1644,6 +1694,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -1694,6 +1748,8 @@ namespace PHPSTORM_META {
]));
override(\resolve(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -1831,6 +1887,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
@@ -1881,6 +1941,8 @@ namespace PHPSTORM_META {
]));
override(\Psr\Container\ContainerInterface::get(0), map([
'' => '@',
'App\Settings\GeneralSettings' => \App\Settings\GeneralSettings::class,
'App\Settings\InfluxDbSettings' => \App\Settings\InfluxDbSettings::class,
'BladeUI\Icons\Factory' => \BladeUI\Icons\Factory::class,
'BladeUI\Icons\IconsManifest' => \BladeUI\Icons\IconsManifest::class,
'Filament\Http\Responses\Auth\Contracts\LoginResponse' => \Filament\Http\Responses\Auth\LoginResponse::class,
@@ -2018,6 +2080,10 @@ namespace PHPSTORM_META {
'Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder' => \Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder::class,
'Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder' => \Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder::class,
'Spatie\LaravelIgnition\Support\SentReports' => \Spatie\LaravelIgnition\Support\SentReports::class,
'Spatie\LaravelSettings\SettingsCache' => \Spatie\LaravelSettings\SettingsCache::class,
'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class,
'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'Squire\RepositoryManager' => \Squire\RepositoryManager::class,
'Whoops\Handler\HandlerInterface' => \Spatie\LaravelIgnition\Renderers\IgnitionWhoopsHandler::class,
'auth' => \Illuminate\Auth\AuthManager::class,
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class,
+9 -14
View File
@@ -3,9 +3,8 @@
namespace App\Console\Commands;
use App\Models\Result;
use App\Settings\InfluxDbSettings;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Symfony\Component\Yaml\Yaml;
class TestInfluxDB extends Command
{
@@ -28,19 +27,15 @@ class TestInfluxDB extends Command
*
* @return int
*/
public function handle()
public function handle(InfluxDbSettings $settings)
{
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'];
$influxdb = [
'enabled' => $settings->v2_enabled,
'url' => optional($settings)->v2_url,
'org' => optional($settings)->v2_org,
'bucket' => optional($settings)->v2_bucket,
'token' => optional($settings)->v2_token,
];
if ($influxdb['enabled'] == true) {
$result = Result::factory()->create();
+9 -2
View File
@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
use App\Filament\Widgets\StatsOverview;
use App\Jobs\ExecSpeedtest;
use App\Settings\GeneralSettings;
use Filament\Notifications\Notification;
use Filament\Pages\Actions\Action;
use Filament\Pages\Dashboard as BasePage;
@@ -28,9 +29,15 @@ class Dashboard extends BasePage
];
}
public function queueSpeedtest()
public function queueSpeedtest(GeneralSettings $settings)
{
ExecSpeedtest::dispatch();
$speedtest = [
'enabled' => ! blank($settings->speedtest_schedule),
'schedule' => optional($settings)->speedtest_schedule,
'ookla_server_id' => optional($settings)->speedtest_server,
];
ExecSpeedtest::dispatch(speedtest: $speedtest, scheduled: false);
Notification::make()
->title('Speedtest added to the queue')
+89
View File
@@ -0,0 +1,89 @@
<?php
namespace App\Filament\Pages\Settings;
use App\Settings\GeneralSettings;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Pages\SettingsPage;
use Squire\Models\Timezone;
class General extends SettingsPage
{
protected static ?string $navigationIcon = 'heroicon-o-cog';
protected static ?string $navigationGroup = 'Settings';
protected static ?int $navigationSort = 1;
protected static string $settings = GeneralSettings::class;
protected function getFormSchema(): array
{
return [
Grid::make([
'default' => 1,
'md' => 3,
])
->schema([
Grid::make([
'default' => 1,
])
->schema([
Section::make('Site Settings')
->collapsible()
->schema([
TextInput::make('site_name')
->maxLength(50)
->required()
->columnSpan(['md' => 2]),
Select::make('timezone')
->options(Timezone::all()->pluck('code', 'code'))
->searchable()
->required()
->columnSpan(1),
])
->columns([
'default' => 1,
'md' => 2,
]),
Section::make('Speedtest Settings')
->collapsible()
->schema([
TextInput::make('speedtest_schedule')
->helperText('Leave empty to disable the schedule. You can also use the cron expression generator [HERE](https://crontab.cronhub.io/) to help you make schedules.')
->nullable()
->columnSpan(1),
TextInput::make('speedtest_server')
->helperText('Leave empty to let the system pick the best server.')
->nullable()
->columnSpan(1),
])
->columns([
'default' => 1,
'md' => 2,
]),
])
->columnSpan([
'md' => 2,
]),
Card::make()
->schema([
Toggle::make('auth_enabled')
->label('Authentication enabled')
->helperText("NOTE: Authentication is currently required. It's on the roadmap to be able to disabled it though.")
->disabled(),
])
->columnSpan([
'md' => 1,
]),
]),
];
}
}
+82
View File
@@ -0,0 +1,82 @@
<?php
namespace App\Filament\Pages\Settings;
use App\Settings\InfluxDbSettings;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Pages\SettingsPage;
class InfluxDb extends SettingsPage
{
protected static ?string $navigationIcon = 'heroicon-o-database';
protected static ?string $navigationLabel = 'InfluxDB';
protected static ?string $navigationGroup = 'Settings';
protected static ?int $navigationSort = 2;
protected static string $settings = InfluxDbSettings::class;
protected function getFormSchema(): array
{
return [
Grid::make([
'default' => 1,
'md' => 3,
])
->schema([
Grid::make([
'default' => 1,
])
->schema([
Section::make('InfluxDB v2 Settings')
->collapsible()
->schema([
TextInput::make('v2_url')
->label('URL')
->placeholder('http://your-influxdb-instance')
->maxLength(255)
->columnSpan(['md' => 2]),
TextInput::make('v2_org')
->label('Org')
->maxLength(255)
->columnSpan(1),
TextInput::make('v2_bucket')
->placeholder('speedtest-tracker')
->label('Bucket')
->maxLength(255)
->columnSpan(1),
TextInput::make('v2_token')
->label('Token')
->maxLength(255)
->password()
->disableAutocomplete()
->columnSpan(['md' => 2]),
])
->columns([
'default' => 1,
'md' => 2,
]),
])
->columnSpan([
'md' => 2,
]),
Card::make()
->schema([
Toggle::make('v2_enabled')
->label('v2 enabled')
->helperText('NOTE: At this time only InfluxDB v2 is supported'),
])
->columnSpan([
'md' => 1,
]),
]),
];
}
}
+12 -27
View File
@@ -2,52 +2,37 @@
namespace App\Jobs;
use App\Settings\GeneralSettings;
use Cron\CronExpression;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\File;
use Symfony\Component\Yaml\Yaml;
class SearchForSpeedtests implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
public function handle(GeneralSettings $settings)
{
if (File::exists(base_path().'/config.yml')) {
$config = Yaml::parseFile(
base_path().'/config.yml'
);
}
$speedtest = [
'enabled' => ! blank($settings->speedtest_schedule),
'schedule' => optional($settings)->speedtest_schedule,
'ookla_server_id' => optional($settings)->speedtest_server,
];
if (File::exists('/app/config.yml')) {
$config = Yaml::parseFile('/app/config.yml');
}
if ($speedtest['enabled']) {
$cron = new CronExpression($speedtest['schedule']);
$speedtest = $config['speedtest'];
$cron = new CronExpression($speedtest['schedule']);
if ($cron->isDue() && $speedtest['enabled']) {
ExecSpeedtest::dispatch(speedtest: $speedtest, scheduled: true);
if ($cron->isDue()) {
ExecSpeedtest::dispatch(speedtest: $speedtest, scheduled: true);
}
}
}
}
+15 -13
View File
@@ -3,10 +3,9 @@
namespace App\Observers;
use App\Models\Result;
use Illuminate\Support\Facades\File;
use App\Settings\InfluxDbSettings;
use Illuminate\Support\Facades\Log;
use InfluxDB2\Client;
use Symfony\Component\Yaml\Yaml;
class ResultObserver
{
@@ -17,6 +16,13 @@ class ResultObserver
*/
public $afterCommit = true;
public $settings;
public function __construct(InfluxDbSettings $settings)
{
$this->settings = $settings;
}
/**
* Handle the Result "created" event.
*
@@ -25,17 +31,13 @@ class ResultObserver
*/
public function created(Result $result)
{
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'];
$influxdb = [
'enabled' => $this->settings->v2_enabled,
'url' => optional($this->settings)->v2_url,
'org' => optional($this->settings)->v2_org,
'bucket' => optional($this->settings)->v2_bucket,
'token' => optional($this->settings)->v2_token,
];
if ($influxdb['enabled'] == true) {
$client = new Client([
@@ -27,6 +27,7 @@ class FilamentServiceProvider extends ServiceProvider
{
Filament::serving(function () {
Filament::registerNavigationGroups([
'Settings',
'Links',
]);
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Settings;
use Spatie\LaravelSettings\Settings;
class GeneralSettings extends Settings
{
public bool $auth_enabled;
public ?string $speedtest_schedule;
public ?string $speedtest_server;
public string $site_name;
public string $timezone;
public static function group(): string
{
return 'general';
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Settings;
use Spatie\LaravelSettings\Settings;
class InfluxDbSettings extends Settings
{
public bool $v2_enabled;
public ?string $v2_url;
public ?string $v2_org;
public ?string $v2_bucket;
public ?string $v2_token;
public static function group(): string
{
return 'influxdb';
}
}
+3 -1
View File
@@ -9,12 +9,14 @@
"doctrine/dbal": "^3.4",
"dragonmantank/cron-expression": "^3.3",
"filament/filament": "^2.0",
"filament/spatie-laravel-settings-plugin": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"influxdata/influxdb-client-php": "^2.9",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"symfony/yaml": "^6.1"
"spatie/laravel-settings": "^2.4",
"squirephp/timezones-en": "^3.3"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",
Generated
+628 -183
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b5629ef1f999b563b144e2a44f5a7d3c",
"content-hash": "01f8953578f096fdfe8f259c2682fc0b",
"packages": [
{
"name": "akaunting/laravel-money",
@@ -1266,6 +1266,53 @@
},
"time": "2022-10-17T08:43:26+00:00"
},
{
"name": "filament/spatie-laravel-settings-plugin",
"version": "v2.16.35",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/spatie-laravel-settings-plugin.git",
"reference": "61a0e2725c390f6ec3d3075246dcdc0f50c405dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/spatie-laravel-settings-plugin/zipball/61a0e2725c390f6ec3d3075246dcdc0f50c405dc",
"reference": "61a0e2725c390f6ec3d3075246dcdc0f50c405dc",
"shasum": ""
},
"require": {
"filament/filament": "self.version",
"illuminate/console": "^8.6|^9.0",
"illuminate/filesystem": "^8.6|^9.0",
"illuminate/support": "^8.6|^9.0",
"php": "^8.0",
"spatie/laravel-settings": "^2.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Filament\\SpatieLaravelSettingsPluginServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Filament\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Filament support for `spatie/laravel-settings`.",
"homepage": "https://github.com/filamentphp/filament",
"support": {
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2022-10-17T08:43:16+00:00"
},
{
"name": "filament/support",
"version": "v2.16.35",
@@ -3301,6 +3348,114 @@
],
"time": "2022-10-17T15:20:29+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.6.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "*",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.13.9",
"vimeo/psalm": "^4.25"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
},
"time": "2022-10-14T12:47:21+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.0",
@@ -4160,6 +4315,69 @@
],
"time": "2022-09-02T11:04:28+00:00"
},
{
"name": "spatie/data-transfer-object",
"version": "3.9.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/data-transfer-object.git",
"reference": "1df0906c4e9e3aebd6c0506fd82c8b7d5548c1c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/data-transfer-object/zipball/1df0906c4e9e3aebd6c0506fd82c8b7d5548c1c8",
"reference": "1df0906c4e9e3aebd6c0506fd82c8b7d5548c1c8",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"illuminate/collections": "^8.36",
"jetbrains/phpstorm-attributes": "^1.0",
"larapack/dd": "^1.1",
"phpunit/phpunit": "^9.5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\DataTransferObject\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brent Roose",
"email": "brent@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Data transfer objects with batteries included",
"homepage": "https://github.com/spatie/data-transfer-object",
"keywords": [
"data-transfer-object",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/data-transfer-object/issues",
"source": "https://github.com/spatie/data-transfer-object/tree/3.9.1"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-09-16T13:34:38+00:00"
},
{
"name": "spatie/invade",
"version": "1.1.1",
@@ -4285,6 +4503,415 @@
],
"time": "2022-10-11T06:37:42+00:00"
},
{
"name": "spatie/laravel-settings",
"version": "2.4.5",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-settings.git",
"reference": "f16a8d29c126deadddb84fff495212d2393cc850"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-settings/zipball/f16a8d29c126deadddb84fff495212d2393cc850",
"reference": "f16a8d29c126deadddb84fff495212d2393cc850",
"shasum": ""
},
"require": {
"doctrine/dbal": "^2.13|^3.2",
"ext-json": "*",
"illuminate/database": "^8.73|^9.0",
"php": "^7.4|^8.0",
"phpdocumentor/type-resolver": "^1.5",
"spatie/data-transfer-object": "^2.8|^3.7",
"spatie/temporary-directory": "^1.3|^2.0"
},
"require-dev": {
"ext-redis": "*",
"mockery/mockery": "^1.4",
"nunomaduro/larastan": "^1.0",
"orchestra/testbench": "^6.23|^7.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5",
"spatie/pest-plugin-snapshots": "^1.1",
"spatie/phpunit-snapshot-assertions": "^4.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\LaravelSettings\\LaravelSettingsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\LaravelSettings\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ruben Van Assche",
"email": "ruben@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Store your application settings",
"homepage": "https://github.com/spatie/laravel-settings",
"keywords": [
"laravel-settings",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-settings/issues",
"source": "https://github.com/spatie/laravel-settings/tree/2.4.5"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-09-28T14:10:27+00:00"
},
{
"name": "spatie/temporary-directory",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/temporary-directory.git",
"reference": "e2818d871783d520b319c2d38dc37c10ecdcde20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/temporary-directory/zipball/e2818d871783d520b319c2d38dc37c10ecdcde20",
"reference": "e2818d871783d520b319c2d38dc37c10ecdcde20",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\TemporaryDirectory\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alex Vanderbist",
"email": "alex@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Easily create, use and destroy temporary directories",
"homepage": "https://github.com/spatie/temporary-directory",
"keywords": [
"php",
"spatie",
"temporary-directory"
],
"support": {
"issues": "https://github.com/spatie/temporary-directory/issues",
"source": "https://github.com/spatie/temporary-directory/tree/2.1.1"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-08-23T07:15:15+00:00"
},
{
"name": "squirephp/model",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squirephp/model.git",
"reference": "2ef9669c10dd17e44b22575a2796f25b788a99f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squirephp/model/zipball/2ef9669c10dd17e44b22575a2796f25b788a99f0",
"reference": "2ef9669c10dd17e44b22575a2796f25b788a99f0",
"shasum": ""
},
"require": {
"ext-pdo_sqlite": "*",
"illuminate/database": "^8.40|^9.0",
"illuminate/support": "^8.0|^9.0",
"php": "^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Squire\\ModelServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dan Harrin",
"email": "dan@danharrin.com"
}
],
"description": "A library containing the base Squire model class.",
"homepage": "https://github.com/squirephp",
"keywords": [
"squire"
],
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"time": "2022-02-08T08:50:39+00:00"
},
{
"name": "squirephp/repository",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squirephp/repository.git",
"reference": "1778190fea82ac6b4d3c2eacbf43ba2d3efe9dd5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squirephp/repository/zipball/1778190fea82ac6b4d3c2eacbf43ba2d3efe9dd5",
"reference": "1778190fea82ac6b4d3c2eacbf43ba2d3efe9dd5",
"shasum": ""
},
"require": {
"illuminate/support": "^8.0|^9.0",
"php": "^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Squire\\RepositoryServiceProvider"
],
"aliases": {
"RepositoryManager": "Squire\\Repository\\Facades\\Repository"
}
}
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dan Harrin",
"email": "dan@danharrin.com"
}
],
"description": "A library containing the Squire repository.",
"homepage": "https://github.com/squirephp",
"keywords": [
"squire"
],
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"time": "2022-02-08T08:51:10+00:00"
},
{
"name": "squirephp/rule",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squirephp/rule.git",
"reference": "a1650e38aedcc1a7ce51e47340f17a9a4848ad9b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squirephp/rule/zipball/a1650e38aedcc1a7ce51e47340f17a9a4848ad9b",
"reference": "a1650e38aedcc1a7ce51e47340f17a9a4848ad9b",
"shasum": ""
},
"require": {
"illuminate/contracts": "^8.0|^9.0",
"illuminate/database": "^8.40|^9.0",
"illuminate/support": "^8.0|^9.0",
"php": "^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dan Harrin",
"email": "dan@danharrin.com"
}
],
"description": "A library containing the base Squire rule class.",
"homepage": "https://github.com/squirephp",
"keywords": [
"squire"
],
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"time": "2022-02-08T08:51:11+00:00"
},
{
"name": "squirephp/timezones",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squirephp/timezones.git",
"reference": "0bac51dacb5648f78e9030aca88363431d897c53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squirephp/timezones/zipball/0bac51dacb5648f78e9030aca88363431d897c53",
"reference": "0bac51dacb5648f78e9030aca88363431d897c53",
"shasum": ""
},
"require": {
"illuminate/support": "^8.0|^9.0",
"php": "^8.0",
"squirephp/model": "self.version",
"squirephp/rule": "self.version"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Squire\\TimezonesServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dan Harrin",
"email": "dan@danharrin.com"
}
],
"description": "A library containing Squire's Timezone model.",
"homepage": "https://github.com/squirephp",
"keywords": [
"squire"
],
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"time": "2022-02-08T08:51:13+00:00"
},
{
"name": "squirephp/timezones-en",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squirephp/timezones-en.git",
"reference": "48072b8d77480889f5be3eb7e615415d51767c58"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squirephp/timezones-en/zipball/48072b8d77480889f5be3eb7e615415d51767c58",
"reference": "48072b8d77480889f5be3eb7e615415d51767c58",
"shasum": ""
},
"require": {
"illuminate/support": "^8.0|^9.0",
"php": "^8.0",
"squirephp/repository": "self.version",
"squirephp/timezones": "self.version"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Squire\\TimezonesEnServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dan Harrin",
"email": "dan@danharrin.com"
}
],
"description": "A library containing the English translation of Squire's Timezone model.",
"homepage": "https://github.com/squirephp",
"keywords": [
"squire"
],
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"time": "2022-02-08T08:51:14+00:00"
},
{
"name": "symfony/console",
"version": "v6.1.6",
@@ -6546,80 +7173,6 @@
],
"time": "2022-10-07T08:04:03+00:00"
},
{
"name": "symfony/yaml",
"version": "v6.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "66c6b0cf52b00f74614a2cf7ae7db08ea1095931"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/66c6b0cf52b00f74614a2cf7ae7db08ea1095931",
"reference": "66c6b0cf52b00f74614a2cf7ae7db08ea1095931",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<5.4"
},
"require-dev": {
"symfony/console": "^5.4|^6.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"bin": [
"Resources/bin/yaml-lint"
],
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.1.6"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-10-07T08:04:03+00:00"
},
{
"name": "tgalopin/html-sanitizer",
"version": "1.5.0",
@@ -7872,114 +8425,6 @@
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.6.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "*",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.13.9",
"vimeo/psalm": "^4.25"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
},
"time": "2022-10-14T12:47:21+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.17",
-20
View File
@@ -1,20 +0,0 @@
---
authentication: true
influxdb:
enabled: false
version: 2 # Only InfluxDB2 is supported right now
url: 'http://your-influxdb-instance' # Full url to your InfluxDB instance, sometimes this includes a port number
org: '' # Organization name, usually created when you installed InfluxDB
bucket: 'speedtest-tracker' # A name location to store the speedtest data in
token: '' # This is your API token
notifications:
channels:
discord:
webhook_url: null # Set as null to disable
slack:
webhook_url: null # Set as null to disable
speedtest:
enabled: true
schedule: '*/60 * * * *' # every hour
ookla_server_id: null # specify a server ID to use a specific server
tz: 'UTC'
+80
View File
@@ -0,0 +1,80 @@
<?php
return [
/*
* Each settings class used in your application must be registered, you can
* put them (manually) here.
*/
'settings' => [
],
/*
* In these directories settings migrations will be stored and ran when migrating. A settings
* migration created via the make:settings-migration command will be stored in the first path or
* a custom defined path when running the command.
*/
'migrations_paths' => [
database_path('settings'),
],
/*
* When no repository was set for a settings class the following repository
* will be used for loading and saving settings.
*/
'default_repository' => 'database',
/*
* Settings will be stored and loaded from these repositories.
*/
'repositories' => [
'database' => [
'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
'model' => null,
'table' => null,
'connection' => null,
],
'redis' => [
'type' => Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository::class,
'connection' => null,
'prefix' => null,
],
],
/*
* The contents of settings classes can be cached through your application,
* settings will be stored within a provided Laravel store and can have an
* additional prefix.
*/
'cache' => [
'enabled' => env('SETTINGS_CACHE_ENABLED', false),
'store' => null,
'prefix' => null,
'ttl' => null,
],
/*
* These global casts will be automatically used whenever a property within
* your settings class isn't a default PHP type.
*/
'global_casts' => [
DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class,
DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class,
Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
],
/*
* The package will look for settings in these paths and automatically
* register them.
*/
'auto_discover_settings' => [
app()->path(),
],
/*
* Automatically discovered settings classes can be cached so they don't
* need to be searched each time the application boots up.
*/
'discovered_settings_cache_path' => storage_path('app/laravel-settings'),
];
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
{
public function up()
{
Schema::create('settings', function (Blueprint $table): void {
$table->id();
$table->string('group')->index();
$table->string('name');
$table->boolean('locked');
$table->json('payload');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('settings');
}
}
@@ -0,0 +1,15 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsMigration;
class CreateGeneralSettings extends SettingsMigration
{
public function up(): void
{
$this->migrator->add('general.auth_enabled', true);
$this->migrator->add('general.site_name', 'Speedtest Tracker');
$this->migrator->add('general.speedtest_schedule', '0 * * * *'); // every hour
$this->migrator->add('general.speedtest_server', null);
$this->migrator->add('general.timezone', 'UTC');
}
}
@@ -0,0 +1,15 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsMigration;
class CreateInfluxDbSettings extends SettingsMigration
{
public function up(): void
{
$this->migrator->add('influxdb.v2_enabled', false);
$this->migrator->add('influxdb.v2_url', null);
$this->migrator->add('influxdb.v2_org', null);
$this->migrator->add('influxdb.v2_bucket', 'speedtest-tracker');
$this->migrator->add('influxdb.v2_token', null);
}
}
@@ -39,19 +39,10 @@ else
echo "✅ Environment file exists"
fi
# Check for config file
if [ ! -f /config/config.yml ]; then
echo "🙄 Config file not found, creating..."
cp $WEBUSER_HOME/config.example.yml /config/config.yml
else
echo "✅ Environment file exists"
fi
# create symlinks
echo "🔗 Creating symlinks to config and log files"
symlinks=( \
/var/www/html/.env \
/var/www/html/config.yml \
/var/www/html/storage/logs/laravel.log
)