$s['bridge'],'CODEAPI_AUTH_PROVIDER'=>'librechat-jwt','CODEAPI_JWT_ENABLED'=>'true','CODEAPI_JWT_ALGORITHM'=>'EdDSA','CODEAPI_JWT_KID'=>'librechat-nodes-20261012','CODEAPI_JWT_ISSUER'=>'librechat','CODEAPI_JWT_AUDIENCE'=>'codeapi','CODEAPI_JWT_SINGLE_TENANT_ID'=>'legacy','CODEAPI_JWT_TTL_SECONDS'=>'300','CODEAPI_JWT_PRIVATE_KEY_BASE64'=>$s['jwtPrivateBase64'],'LIBRECHAT_CODE_BASEURL_STATEFUL'=>'https://192.168.1.2:3144/v1','NODE_EXTRA_CA_CERTS'=>'/etc/librechat-code/ca.pem']; foreach($env as$k=>$v){$found=false;foreach($x->Config as$c)if((string)$c['Target']===$k){$c[0]=$v;$found=true;break;}if(!$found){$c=$x->addChild('Config',htmlspecialchars($v,ENT_XML1));foreach(['Name'=>$k,'Target'=>$k,'Type'=>'Variable','Mode'=>'','Display'=>'always','Mask'=>(strpos($k,'PRIVATE')!==false || strpos($k,'TOKEN')!==false)?'true':'false']as$a=>$z)$c->addAttribute($a,$z);}} $has=false;foreach($x->Config as$c)if((string)$c['Target']==='/etc/librechat-code/ca.pem')$has=true;if(!$has){$c=$x->addChild('Config',$root.'/tls/ca.pem');foreach(['Name'=>'Private Code API CA','Target'=>'/etc/librechat-code/ca.pem','Type'=>'Path','Mode'=>'ro','Display'=>'always']as$a=>$z)$c->addAttribute($a,$z);} $x->asXML($path);chmod($path,0600); checked(['docker','cp',$lc.'/librechat.yaml','LibreChat:/tmp/workspace-config-check.yaml']); [$rc,$o,$err]=cmd(['docker','exec','LibreChat','node','-e','const fs=require("fs"),y=require("js-yaml"),d=require("librechat-data-provider"); const c=y.load(fs.readFileSync("/tmp/workspace-config-check.yaml","utf8"));const r=d.configSchema.safeParse(c);if(!r.success){console.log(JSON.stringify(r.error.issues));process.exit(1)}console.log("Config schema validated");']); if($rc){copy($dir.'/my-LibreChat.xml',$path);copy($dir.'/librechat.yaml',$lc.'/librechat.yaml');echo $o;throw new Exception('Schema validation failed; original configuration restored');}echo $o; $a=['docker','create','--name','LibreChat','--network','bridge','--restart','unless-stopped','--pids-limit','2048','-l','net.unraid.docker.managed=dockerman'];foreach(['WebUI'=>'net.unraid.docker.webui','Icon'=>'net.unraid.docker.icon']as$k=>$v)if((string)$x->$k!='')array_push($a,'-l',$v.'='.(string)$x->$k);foreach($x->Config as$c){$v=(string)$c;$target=(string)$c['Target'];$type=(string)$c['Type'];if($type==='Variable')array_push($a,'-e',$target.'='.$v);elseif($type==='Port')array_push($a,'-p',$v.':'.$target.'/'.(string)$c['Mode']);elseif($type==='Path')array_push($a,'-v',$v.':'.$target.':'.(string)$c['Mode']);else throw new Exception('Unknown template config');}$a[]=(string)$x->Repository; checked(['docker','stop','--time','30','LibreChat']);checked(['docker','rm','LibreChat']);checked($a);checked(['docker','start','LibreChat']); echo json_encode(['workspace_enabled'=>true,'same_librechat_container'=>true,'backup'=>$dir])."\n";