From ef2c179a68a4ff8abc0950cb3232a9d94072b254 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Mon, 15 May 2023 21:40:05 +0200 Subject: [PATCH] show existing domain info on get page --- src/service.rs | 25 ++++++++++++++----------- src/service/http_tpl/domain.html | 10 ++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/service.rs b/src/service.rs index fdd13e1..b0b02cc 100644 --- a/src/service.rs +++ b/src/service.rs @@ -179,19 +179,22 @@ impl<'svc> Service<'svc> { config: Option, } - match self.domain_manager.get_config(&args.domain) { - Ok(_config) => self.render_error_page(500, "TODO not yet implemented"), - Err(domain::manager::GetConfigError::NotFound) => self.render_page( - "/domain.html", - &Response { - domain: args.domain, - config: None, - }, - ), + let config = match self.domain_manager.get_config(&args.domain) { + Ok(config) => Some(config), + Err(domain::manager::GetConfigError::NotFound) => None, Err(domain::manager::GetConfigError::Unexpected(e)) => { - self.render_error_page(500, format!("retrieving configuration: {}", e).as_str()) + return self + .render_error_page(500, format!("retrieving configuration: {}", e).as_str()); } - } + }; + + self.render_page( + "/domain.html", + &Response { + domain: args.domain, + config: config, + }, + ) } fn domain_init(&self, args: DomainInitArgs, domain_config: util::FlatConfig) -> SvcResponse { diff --git a/src/service/http_tpl/domain.html b/src/service/http_tpl/domain.html index 4d78193..4f90dd0 100644 --- a/src/service/http_tpl/domain.html +++ b/src/service/http_tpl/domain.html @@ -2,11 +2,21 @@ Configure New Domain +{{# if data.config }} + +

Your domain {{ data.domain }} 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.

+ +{{ else }} +

Your domain {{ data.domain }} is not yet configured with Domiply. 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 automatically updated too!

+{{/if}} +

In the future Domiply will support more backends than just git repos.