增加打包配置设置

This commit is contained in:
2022-11-26 10:23:43 +08:00
parent 9a04549c86
commit f4ff7eb1fb
3 changed files with 15 additions and 7 deletions

View File

@@ -561,7 +561,7 @@ class Dist extends Command
*/
public function buildAllAppDir()
{
$list = $this->appFilesystem->listContents('');
$list = $this->appFilesystem->listContents('app');
foreach ($list as $item) {
if ($item['type'] != 'dir') {

View File

@@ -18,6 +18,7 @@ use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;
use think\facade\Config;
class ReadEnvVisitorNodeTools extends NodeVisitorAbstract
{
@@ -99,9 +100,14 @@ class ReadEnvVisitorNodeTools extends NodeVisitorAbstract
return new Array_($value);
} else if (is_string($value)) {
return new FuncCall(new Name('base64_decode'), [
new Arg(new String_(base64_encode($value)))
]);
$env_pack_mode = Config::get('dist.pack_env_mode');
if ($env_pack_mode == 0) {
return new FuncCall(new Name('base64_decode'), [
new Arg(new String_(base64_encode($value)))
]);
}
return new String_($value);
} else if (is_integer($value)) {

View File

@@ -29,16 +29,18 @@ return [
'/config.php/',
'/^public\/index\.php/',
'/^public\/router\.php/',
'/^app\/admin\/service\/initAdminData\/*/',
],
// 希望将env打包的文件
'pack_env_path'=>[
'pack_env_path' => [
'/^app/',
'/^config/',
'/^database/',
'/^extend/',
'/^lib/',
'/^route/',
]
],
// 0:base64方式处理,1:明文打包
'pack_env_mode' => 1
];