Skip to content

Commit ee54fe7

Browse files
committed
chore(config): Add sudo password option
- Add 'sudo_password' option to the Soar configuration file - Allows setting the sudo password for non-cli environments
1 parent 31cc505 commit ee54fe7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

config/soar.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
// soar 路径
1818
'path' => env('SOAR_PATH'),
1919

20+
// sudo 密码(在 unix 操作系统非 cli 环境中运行时需要设置)
21+
'sudo_password' => env('SOAR_SUDO_PASSWORD'),
22+
2023
// 排除 soar 评分的 sql
2124
'except' => [
2225
'^use \?$',

src/SoarServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ protected function registerSoar(): void
121121
{
122122
$this->app->singleton(
123123
Soar::class,
124-
static fn (): Soar => Soar::create(config('soar.options', []), config('soar.path'))
124+
static fn (): Soar => Soar::create(
125+
config('soar.options', []),
126+
config('soar.path')
127+
)->setSudoPassword(config('soar.sudo_password'))
125128
);
126129

127130
$this->app->alias(Soar::class, $this->toAlias(Soar::class));

0 commit comments

Comments
 (0)