未验证 提交 f57ddf02 编写于 作者: Q qkqpttgf 提交者: GitHub

fix: can edit config manually

上级 bc12e82c
......@@ -58,7 +58,8 @@ function getConfig($str, $disktag = '')
global $Base64Env;
//include 'config.php';
$s = file_get_contents('config.php');
$configs = substr($s, 18, -2);
//$configs = substr($s, 18, -2);
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
if ($configs!='') {
$envs = json_decode($configs, true);
if (in_array($str, $InnerEnv)) {
......@@ -84,7 +85,8 @@ function setConfig($arr, $disktag = '')
if ($disktag=='') $disktag = $_SERVER['disktag'];
//include 'config.php';
$s = file_get_contents('config.php');
$configs = substr($s, 18, -2);
//$configs = substr($s, 18, -2);
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
if ($configs!='') $envs = json_decode($configs, true);
$disktags = explode("|",getConfig('disktag'));
$indisk = 0;
......@@ -370,10 +372,8 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
copyFolder($coderoot, $outPath);
// 将配置写入
$prestr = '<?php $configs = \'
';
$aftstr = '
\';';
$prestr = '<?php $configs = \'' . PHP_EOL;
$aftstr = PHP_EOL . '\';';
file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
// 将目录中文件打包成zip
......@@ -444,7 +444,8 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
$s = file_get_contents('config.php');
$configs = substr($s, 18, -2);
//$configs = substr($s, 18, -2);
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
if ($configs!='') $envs = json_decode($configs, true);
foreach ($Envs as $k => $v) {
$envs[$k] = $v;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册