* Examples: * php docker/set-domain.php hotel-test.example.de 1 (behind nginx with HTTPS) * php docker/set-domain.php 192.168.1.50:8080 0 (direct LAN test, no nginx) */ if (PHP_SAPI !== 'cli') { exit("CLI only\n"); } if ($argc < 3 || !in_array($argv[2], array('0', '1'), true)) { fwrite(STDERR, "Usage: php docker/set-domain.php \n"); exit(1); } $domain = preg_replace('#^https?://#i', '', rtrim(trim($argv[1]), '/')); $ssl = (int)$argv[2]; if (!preg_match('/^[A-Za-z0-9.-]+(:\d+)?$/', $domain)) { fwrite(STDERR, "Invalid host: $domain\n"); exit(1); } define('_PS_ADMIN_DIR_', __DIR__); require __DIR__.'/../config/config.inc.php'; Configuration::updateValue('PS_SHOP_DOMAIN', $domain); Configuration::updateValue('PS_SHOP_DOMAIN_SSL', $domain); Configuration::updateValue('PS_SSL_ENABLED', $ssl); Configuration::updateValue('PS_SSL_ENABLED_EVERYWHERE', $ssl); Db::getInstance()->update('shop_url', array('domain' => pSQL($domain), 'domain_ssl' => pSQL($domain)), 'main = 1'); Tools::generateHtaccess(); Tools::clearSmartyCache(); Tools::clearCache(); echo 'Shop URL: '.($ssl ? 'https' : 'http').'://'.$domain."/\n";