show existing domain info on get page

This commit is contained in:
Brian Picciano 2023-05-15 21:40:05 +02:00
parent 6c32af061b
commit ef2c179a68
2 changed files with 24 additions and 11 deletions

View File

@ -179,19 +179,22 @@ impl<'svc> Service<'svc> {
config: Option<domain::config::Config>, config: Option<domain::config::Config>,
} }
match self.domain_manager.get_config(&args.domain) { let config = match self.domain_manager.get_config(&args.domain) {
Ok(_config) => self.render_error_page(500, "TODO not yet implemented"), Ok(config) => Some(config),
Err(domain::manager::GetConfigError::NotFound) => self.render_page( Err(domain::manager::GetConfigError::NotFound) => None,
Err(domain::manager::GetConfigError::Unexpected(e)) => {
return self
.render_error_page(500, format!("retrieving configuration: {}", e).as_str());
}
};
self.render_page(
"/domain.html", "/domain.html",
&Response { &Response {
domain: args.domain, domain: args.domain,
config: None, config: config,
}, },
), )
Err(domain::manager::GetConfigError::Unexpected(e)) => {
self.render_error_page(500, format!("retrieving configuration: {}", e).as_str())
}
}
} }
fn domain_init(&self, args: DomainInitArgs, domain_config: util::FlatConfig) -> SvcResponse { fn domain_init(&self, args: DomainInitArgs, domain_config: util::FlatConfig) -> SvcResponse {

View File

@ -2,11 +2,21 @@
Configure New Domain Configure New Domain
</h2> </h2>
{{# if data.config }}
<p>Your domain <code>{{ data.domain }}</code> is already configured with
Domiply. You can see the existing configuration below. If you modify any values
you will need to hit the "Next" button to complete the update.</p>
{{ else }}
<p>Your domain <code>{{ data.domain }}</code> is not yet configured with Domiply. <p>Your domain <code>{{ data.domain }}</code> is not yet configured with Domiply.
To get started, please input the details of a public git repo which will be used To get started, please input the details of a public git repo which will be used
to serve your domain. When you update the given branch, your domain will be to serve your domain. When you update the given branch, your domain will be
automatically updated too!</p> automatically updated too!</p>
{{/if}}
<p><em>In the future Domiply will support more backends than just git <p><em>In the future Domiply will support more backends than just git
repos.</em></p> repos.</em></p>