templates/deployment.yaml を更新

This commit is contained in:
2025-11-22 13:16:48 +00:00
parent 661bfd2b50
commit d981079c32

View File

@@ -77,12 +77,21 @@ define('SECURE_AUTH_SALT', getenv('WP_SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', getenv('WP_LOGGED_IN_SALT'));
define('NONCE_SALT', getenv('WP_NONCE_SALT'));
// ** WordPress Site URLs ** //
// ** WordPress Site URLs - Dynamic based on HTTP_HOST ** //
if ( defined( 'WP_CLI' ) ) {
$_SERVER['HTTP_HOST'] = '127.0.0.1';
}
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
// Determine protocol (HTTP or HTTPS)
$protocol = 'http';
if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
$protocol = 'https';
} elseif ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ) {
$protocol = 'https';
}
define( 'WP_HOME', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' );
// ** WordPress Core Updates ** //
define( 'WP_AUTO_UPDATE_CORE', false );
@@ -143,10 +152,13 @@ WPCONFIG
echo "$WP_ADMIN_PASSWORD" > /var/www/html-persistent/.initial-admin-password
fi
# 初回インストール用の一時的なURL後で動的に変更される
INSTALL_URL="http://127.0.0.1"
# WordPressのインストール
echo "Installing WordPress..."
/tmp/wp-cli.phar --path=/var/www/html core install \
--url="$WP_SITE_URL" \
--url="$INSTALL_URL" \
--title="$WP_SITE_TITLE" \
--admin_user="$WP_ADMIN_USER" \
--admin_password="$WP_ADMIN_PASSWORD" \
@@ -158,6 +170,7 @@ WPCONFIG
if [ -f /var/www/html-persistent/.initial-admin-password ]; then
echo "Admin Password: $(cat /var/www/html-persistent/.initial-admin-password)"
fi
echo "Note: Site URL is dynamic and will be set based on HTTP_HOST"
else
echo "WordPress is already installed, skipping installation"
@@ -198,8 +211,6 @@ WPCONFIG
key: db-password
- name: WORDPRESS_TABLE_PREFIX
value: {{ .Values.wordpress.tablePrefix | quote }}
- name: WP_SITE_URL
value: {{ .Values.wordpress.siteUrl | quote }}
- name: WP_SITE_TITLE
value: {{ .Values.wordpress.siteTitle | quote }}
- name: WP_ADMIN_USER