diff --git a/migrations/container/20250903101855_site-command_generate_default_self_signed_cert.php b/migrations/container/20250903101855_site-command_generate_default_self_signed_cert.php index 76f5e09c..d47fd7a4 100644 --- a/migrations/container/20250903101855_site-command_generate_default_self_signed_cert.php +++ b/migrations/container/20250903101855_site-command_generate_default_self_signed_cert.php @@ -16,6 +16,10 @@ public function __construct() { $this->certs_dir = EE_ROOT_DIR . '/services/nginx-proxy/certs'; $this->key_path = $this->certs_dir . '/default.key'; $this->crt_path = $this->certs_dir . '/default.crt'; + + if ( ! $this->fs->exists( $this->certs_dir ) ) { + $this->skip_this_migration = true; + } } /** @@ -23,6 +27,13 @@ public function __construct() { * @throws EE\ExitException */ public function up() { + + if ( $this->skip_this_migration ) { + EE::debug( 'Skipping default self-signed cert generation migration as it is not needed.' ); + + return; + } + if ( $this->fs->exists( $this->key_path ) && $this->fs->exists( $this->crt_path ) ) { EE::debug( 'Default self-signed cert already exists. Skipping generation.' );