Maybe now...

master
Manager Bot 3 years ago
parent ee4ce53a70
commit 6d62c91d94
  1. 19
      Web/lib/MJB/Web/Controller/Blog.pm
  2. 2
      Web/lib/MJB/Web/Task/InitializeBlog.pm

@ -44,7 +44,7 @@ sub do_domain_hosted ( $c ) {
return; return;
} }
return $c->_initialize_blog( $sub_domain . '.' . $top_domain->name, 'show_blog_domain_hosted' ); return $c->_initialize_blog( $sub_domain . '.' . $top_domain->name, 'show_blog_domain_hosted', $top_domain->name );
} }
# Initial blog creation entry point when the user # Initial blog creation entry point when the user
@ -78,7 +78,7 @@ sub do_domain_owned ( $c ) {
# forwarded from the domain_hosted / domain_owned requests, and redirecting to # forwarded from the domain_hosted / domain_owned requests, and redirecting to
# a post doesn't work. However, since we're doing things rather than displaying # a post doesn't work. However, since we're doing things rather than displaying
# things, it'll be named with the do_ # things, it'll be named with the do_
sub _initialize_blog ( $c, $domain, $from ) { sub _initialize_blog ( $c, $domain, $from, $ssl_domain ) {
# Do we already have this domain name? # Do we already have this domain name?
if ( $c->db->domain( { name => $domain } ) ) { if ( $c->db->domain( { name => $domain } ) ) {
@ -97,6 +97,7 @@ sub _initialize_blog ( $c, $domain, $from ) {
# Make the domain name record. # Make the domain name record.
my $domain_record = $c->stash->{person}->create_related('domains', { my $domain_record = $c->stash->{person}->create_related('domains', {
name => $domain, name => $domain,
( $ssl_domain ? ( ssl => $ssl_domain ) : () ),
}); });
# Make the website record # Make the website record
@ -121,12 +122,14 @@ sub _initialize_blog ( $c, $domain, $from ) {
} }
# Schedule a job to deploy the website # Schedule a job to deploy the website
my $ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], { if ( ! $ssl_domain ) {
notes => { '_bid_' . $blog->id => 1 }, my $ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], {
priority => $blog->build_priority, notes => { '_bid_' . $blog->id => 1 },
queue => 'certbot', priority => $blog->build_priority,
}); queue => 'certbot',
$blog->create_related( 'builds', { job_id => $ssl_job_id } ); });
$blog->create_related( 'builds', { job_id => $ssl_job_id } );
}
$c->redirect_to( $c->url_for( 'show_blog_settings', { id => $blog->id } ) ); $c->redirect_to( $c->url_for( 'show_blog_settings', { id => $blog->id } ) );
} }

@ -18,7 +18,7 @@ sub run ( $job, $blog_id ) {
my $config_content = MJB::Backend::Nginx::DomainConfig->new( my $config_content = MJB::Backend::Nginx::DomainConfig->new(
domain => $blog->domain->name, domain => $blog->domain->name,
ssl_domain => $blog->domain->name, ssl_domain => ( $blog->domain->ssl ? $blog->domain->ssl : $blog->domain->name ),
)->config; )->config;
my ( $config, $welcome ) = ( tempfile, tempfile ); my ( $config, $welcome ) = ( tempfile, tempfile );

Loading…
Cancel
Save