|
|
|
|
@ -44,7 +44,7 @@ sub do_domain_hosted ( $c ) { |
|
|
|
|
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 |
|
|
|
|
@ -78,7 +78,7 @@ sub do_domain_owned ( $c ) { |
|
|
|
|
# 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 |
|
|
|
|
# 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? |
|
|
|
|
if ( $c->db->domain( { name => $domain } ) ) { |
|
|
|
|
@ -97,6 +97,7 @@ sub _initialize_blog ( $c, $domain, $from ) { |
|
|
|
|
# Make the domain name record. |
|
|
|
|
my $domain_record = $c->stash->{person}->create_related('domains', { |
|
|
|
|
name => $domain, |
|
|
|
|
( $ssl_domain ? ( ssl => $ssl_domain ) : () ), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
# Make the website record |
|
|
|
|
@ -121,12 +122,14 @@ sub _initialize_blog ( $c, $domain, $from ) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Schedule a job to deploy the website |
|
|
|
|
if ( ! $ssl_domain ) { |
|
|
|
|
my $ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], { |
|
|
|
|
notes => { '_bid_' . $blog->id => 1 }, |
|
|
|
|
priority => $blog->build_priority, |
|
|
|
|
queue => 'certbot', |
|
|
|
|
}); |
|
|
|
|
$blog->create_related( 'builds', { job_id => $ssl_job_id } ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$c->redirect_to( $c->url_for( 'show_blog_settings', { id => $blog->id } ) ); |
|
|
|
|
} |
|
|
|
|
|