do nothing with env in updateenv()
parent
5e0626e469
commit
4962a90795
|
@ -332,23 +332,12 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
|
||||||
$zip->open($codezip);
|
$zip->open($codezip);
|
||||||
$html = $zip->extractTo($outPath);
|
$html = $zip->extractTo($outPath);
|
||||||
|
|
||||||
// 获取当前配置并加入新配置
|
// 将配置写入
|
||||||
$tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
|
|
||||||
foreach ($tmp as $tmp1) {
|
|
||||||
$tmp_env[$tmp1['Key']] = $tmp1['Value'];
|
|
||||||
}
|
|
||||||
foreach ($Envs as $key1 => $value1) {
|
|
||||||
$tmp_env[$key1] = $value1;
|
|
||||||
}
|
|
||||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
|
||||||
//$tmp_env['Region'] = $Region;
|
|
||||||
ksort($tmp_env);
|
|
||||||
|
|
||||||
$prestr = '<?php $configs = \'
|
$prestr = '<?php $configs = \'
|
||||||
';
|
';
|
||||||
$aftstr = '
|
$aftstr = '
|
||||||
\';';
|
\';';
|
||||||
file_put_contents($outPath . 'config.php', $prestr . json_encode($tmp_env, JSON_PRETTY_PRINT) . $aftstr);
|
file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||||
|
|
||||||
// 将目录中文件打包成zip
|
// 将目录中文件打包成zip
|
||||||
$source = '/tmp/code.zip';
|
$source = '/tmp/code.zip';
|
||||||
|
@ -396,17 +385,15 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
|
||||||
}
|
}
|
||||||
WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
|
WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
|
||||||
|
|
||||||
$tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
|
$s = file_get_contents('config.php');
|
||||||
foreach ($tmp as $tmp1) {
|
$configs = substr($s, 18, -2);
|
||||||
$tmp_env[$tmp1['Key']] = $tmp1['Value'];
|
if ($configs!='') $envs = json_decode($configs, true);
|
||||||
|
foreach ($Envs as $k => $v) {
|
||||||
|
$envs[$k] = $v;
|
||||||
}
|
}
|
||||||
foreach ($Envs as $key1 => $value1) {
|
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||||
$tmp_env[$key1] = $value1;
|
ksort($envs);
|
||||||
}
|
$response = updateEnvironment($envs, $function_name, $Region, $namespace, $SecretId, $SecretKey);
|
||||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
|
||||||
ksort($tmp_env);
|
|
||||||
$response = updateEnvironment($tmp_env, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey);
|
|
||||||
//WaitSCFStat();
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue