mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
refactor:增加allowed_commands
配置项
This commit is contained in:
parent
9e5da13cee
commit
57a3a4182b
@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\installapi\controller;
|
||||
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 命令执行类
|
||||
*/
|
||||
@ -34,17 +36,12 @@ class CommandExec
|
||||
* 对可以执行的命令进行限制
|
||||
* @var string[]
|
||||
*/
|
||||
protected $command = [
|
||||
'ping-baidu' => 'ping baidu.com',
|
||||
'cnpm-install' => 'cnpm install',
|
||||
'npm-v' => 'npm -v',
|
||||
'cnpm-v' => 'cnpm -v',
|
||||
'node-v' => 'node -v',
|
||||
'install-cnpm' => 'npm install -g cnpm --registry=https://registry.npmmirror.com',
|
||||
'test-install' => 'cd npm-install-test && cnpm install',
|
||||
'web-install' => 'cd ../web && cnpm install',
|
||||
'web-build' => 'cd ../web && cnpm run build:online',
|
||||
];
|
||||
protected $command = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->command = Config::get('buildadmin.allowed_commands');
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
|
@ -5,5 +5,17 @@
|
||||
|
||||
return [
|
||||
// 允许跨域访问的域名
|
||||
'cors_request_domain' => 'localhost,127.0.0.1'
|
||||
'cors_request_domain' => 'localhost,127.0.0.1',
|
||||
// 允许执行的命令
|
||||
'allowed_commands' => [
|
||||
'ping-baidu' => 'ping baidu.com',
|
||||
'cnpm-install' => 'cnpm install',
|
||||
'npm-v' => 'npm -v',
|
||||
'cnpm-v' => 'cnpm -v',
|
||||
'node-v' => 'node -v',
|
||||
'install-cnpm' => 'npm install -g cnpm --registry=https://registry.npmmirror.com',
|
||||
'test-install' => 'cd npm-install-test && cnpm install',
|
||||
'web-install' => 'cd ../web && cnpm install',
|
||||
'web-build' => 'cd ../web && cnpm run build:online',
|
||||
],
|
||||
];
|
Loading…
Reference in New Issue
Block a user