fix: can edit config manually
							parent
							
								
									bc12e82c74
								
							
						
					
					
						commit
						f57ddf02db
					
				| 
						 | 
					@ -58,7 +58,8 @@ function getConfig($str, $disktag = '')
 | 
				
			||||||
    global $Base64Env;
 | 
					    global $Base64Env;
 | 
				
			||||||
    //include 'config.php';
 | 
					    //include 'config.php';
 | 
				
			||||||
    $s = file_get_contents('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!='') {
 | 
					    if ($configs!='') {
 | 
				
			||||||
        $envs = json_decode($configs, true);
 | 
					        $envs = json_decode($configs, true);
 | 
				
			||||||
        if (in_array($str, $InnerEnv)) {
 | 
					        if (in_array($str, $InnerEnv)) {
 | 
				
			||||||
| 
						 | 
					@ -84,7 +85,8 @@ function setConfig($arr, $disktag = '')
 | 
				
			||||||
    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
					    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
    //include 'config.php';
 | 
					    //include 'config.php';
 | 
				
			||||||
    $s = file_get_contents('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 ($configs!='') $envs = json_decode($configs, true);
 | 
				
			||||||
    $disktags = explode("|",getConfig('disktag'));
 | 
					    $disktags = explode("|",getConfig('disktag'));
 | 
				
			||||||
    $indisk = 0;
 | 
					    $indisk = 0;
 | 
				
			||||||
| 
						 | 
					@ -370,10 +372,8 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
 | 
				
			||||||
    copyFolder($coderoot, $outPath);
 | 
					    copyFolder($coderoot, $outPath);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    // 将配置写入
 | 
					    // 将配置写入
 | 
				
			||||||
    $prestr = '<?php $configs = \'
 | 
					    $prestr = '<?php $configs = \'' . PHP_EOL;
 | 
				
			||||||
';
 | 
					    $aftstr = PHP_EOL . '\';';
 | 
				
			||||||
    $aftstr = '
 | 
					 | 
				
			||||||
\';';
 | 
					 | 
				
			||||||
    file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
 | 
					    file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 将目录中文件打包成zip
 | 
					    // 将目录中文件打包成zip
 | 
				
			||||||
| 
						 | 
					@ -444,7 +444,8 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
 | 
				
			||||||
    WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
 | 
					    WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $s = file_get_contents('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 ($configs!='') $envs = json_decode($configs, true);
 | 
				
			||||||
    foreach ($Envs as $k => $v) {
 | 
					    foreach ($Envs as $k => $v) {
 | 
				
			||||||
        $envs[$k] = $v;
 | 
					        $envs[$k] = $v;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue