Skip to content

Commit e591971

Browse files
committed
refactor(config): rename soar exclusions key for consistency
- Rename 'exclusions' key to 'exclude' in soar configuration for improved clarity and consistency - Update references to 'soar.exclusions' in OutputManager to 'soar.exclude' - Modify tests to reflect the updated configuration key
1 parent 213de8b commit e591971

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

config/soar.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@
1313

1414
return [
1515
// 是否启用 soar 评分
16-
'enabled' => (bool) env('SOAR_SCORE_ENABLED', config('app.debug')),
16+
'enabled' => (bool) env('SOAR_SCORE_ENABLED', config('app.debug') && 'local' === config('app.env')),
1717

1818
// soar 二进制文件
1919
'binary' => env('SOAR_BINARY'),
2020

2121
// sudo 密码(在 unix 操作系统非 cli 环境中运行时需要设置)
2222
'sudo_password' => env('SOAR_SUDO_PASSWORD'),
2323

24-
// 排除 soar 评分的 sql
24+
// 排除 soar 评分输出的命令、URL 路径、路由
2525
'except' => [
26+
'telescope:*',
27+
'*telescope*',
28+
],
29+
30+
// 排除 soar 评分的 sql
31+
'except_queries' => [
2632
'^use \?$',
2733
'^set.*',
2834
'^show.*',
@@ -37,12 +43,6 @@
3743
// 'create table*',
3844
],
3945

40-
// 排除 soar 评分输出的命令、URL 路径、路由
41-
'exclusions' => [
42-
'telescope:*',
43-
'*telescope*',
44-
],
45-
4646
// soar 评分输出器
4747
'outputs' => [
4848
// Guanguans\LaravelSoar\Outputs\ClockworkOutput::class,

src/Bootstrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function logQueries(): void
115115

116116
private function isExceptSql(string $sql): bool
117117
{
118-
return Str::is(config('soar.except', []), $sql);
118+
return Str::is(config('soar.except_queries', []), $sql);
119119
}
120120

121121
/**

src/OutputManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class OutputManager extends Fluent implements OutputContract
2828
{
2929
public function shouldOutput(CommandFinished|Response $outputter): bool
3030
{
31-
$exclusions = config('soar.exclusions', []);
31+
$except = config('soar.except', []);
3232

3333
if ($outputter instanceof CommandFinished) {
34-
return !Str::is($exclusions, $outputter->command);
34+
return !Str::is($except, $outputter->command);
3535
}
3636

37-
return !Request::is($exclusions) && !Request::routeIs($exclusions);
37+
return !Request::is($except) && !Request::routeIs($except);
3838
}
3939

4040
public function output(Collection $scores, CommandFinished|Response $outputter): mixed

tests/Feature/OutputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
});
3535

3636
it('can not output soar scores', function (): void {
37-
config()->set('soar.exclusions', ['outputs']);
37+
config()->set('soar.except', ['outputs']);
3838

3939
$this->artisan('outputs')
4040
->assertExitCode(Command::SUCCESS)

0 commit comments

Comments
 (0)