feat(QuickUpload): add text field (pastebin like feat)
This commit is contained in:
parent
b2f27aa3f4
commit
2e6da33574
5 changed files with 61 additions and 11 deletions
|
|
@ -13,17 +13,25 @@ if (!file_exists($path)) {
|
|||
require('./load_config.php');
|
||||
|
||||
$template = file_get_contents('./nginx.conf.template');
|
||||
$phpSocket = '/var/run/php/php8.0-fpm.sock';
|
||||
$phpSocket = $argv[1] ?? '/var/run/php/php8.0-fpm.sock';
|
||||
|
||||
foreach ($config['modules'] as $moduleName => $moduleConfig) {
|
||||
$domains = array_merge([$moduleName], $moduleConfig['alias'] ?? []);
|
||||
$domains = array_map(fn ($d) => $d . '.' . $config['domain'], $domains);
|
||||
$serverName = implode(' ', $domains);
|
||||
|
||||
$nginxConfPath = './modules/' . $moduleName . '/nginx_' . $moduleName . '.conf';
|
||||
$customConfig = '';
|
||||
if (file_exists($nginxConfPath)) {
|
||||
$customConfig = file_get_contents($nginxConfPath);
|
||||
$customConfig = str_replace('{{ROOT_PATH}}', $appBasePath, $customConfig);
|
||||
}
|
||||
|
||||
$nginxConfig = $template;
|
||||
$nginxConfig = str_replace('{{ROOT_PATH}}', $appBasePath, $nginxConfig);
|
||||
$nginxConfig = str_replace('{{SERVER_NAME}}', $serverName, $nginxConfig);
|
||||
$nginxConfig = str_replace('{{PHP_SOCKET}}', $phpSocket, $nginxConfig);
|
||||
$nginxConfig = str_replace('{{CUSTOM_CONFIG}}', $customConfig, $nginxConfig);
|
||||
|
||||
file_put_contents($path . '/' . $domains[0], $nginxConfig);
|
||||
echo "> Wrote " . strlen($nginxConfig) . " bytes in " . $path . '/' . $domains[0] . "\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue