diff --git a/post-deployment-configuration.md b/post-deployment-configuration.md
index 252f25c4..3aeb45ab 100644
--- a/post-deployment-configuration.md
+++ b/post-deployment-configuration.md
@@ -4,6 +4,9 @@
Of course the beauty of a URL shortener is to have short link and this is done the best by a naked domain (domain.com). To realized this you would need to by an expensive certificate with a wild card, and this doesn't fit in the goals of this project. We will achieve it nervertheless by having a secure www.domain.com and doing a dynamic forward of domain.com to www.domain.com.
+[](https://youtu.be/srZv8aj3ZP8)
+
+[https://youtu.be/srZv8aj3ZP8](https://youtu.be/srZv8aj3ZP8)
### 1- Assign a Domain to the Azure Function
Let`s start by Adding a domain to the App Service.
@@ -92,8 +95,22 @@ The URL shortener is now completly configured, and your users will be pleased. T
The TinyBlazorAdmin is the place to manage all your URLs. Create a new Page rule to redirect all call to your domain and the prefix of your choice. ( ex: admin.07f.ca, manager.07f.ca, new.07f.ca, etc)
+
+
+
+### 5- Add the new Custom Domain to the Settings file
+
+The last step is to update the `src\shortenerTools\settings.json`. This is the setting file for the Azure Function. Add (or edit if already present) `customDomain` and set it to your new domain.
+
+```
+ "customDomain":"https://c5m.ca"
+```
+
+
Congradulation, you are all set!
+
+
---
diff --git a/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj b/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
index 6c48a67a..c54717be 100644
--- a/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
+++ b/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
@@ -10,12 +10,12 @@
-
-
-
-
+
+
+
+
-
+
diff --git a/src/shortenerTools/UrlList/UrlList.cs b/src/shortenerTools/UrlList/UrlList.cs
index 32d9fe5c..55aa5c10 100644
--- a/src/shortenerTools/UrlList/UrlList.cs
+++ b/src/shortenerTools/UrlList/UrlList.cs
@@ -60,14 +60,13 @@ public static async Task Run(
}
else
{
- userId = principal.FindFirst(ClaimTypes.GivenName).Value;
- log.LogInformation("Authenticated user {user}.", userId);
+ userId = principal.FindFirst(ClaimTypes.GivenName).Value;
+ log.LogInformation("Authenticated user {user}.", userId);
}
result.UrlList = await stgHelper.GetAllShortUrlEntities();
result.UrlList = result.UrlList.Where(p => !(p.IsArchived ?? false)).ToList();
- //var host = req.HttpContext.RequestUri.GetLeftPart(UriPartial.Authority);
- var host = req.Host.Host;
+ var host = string.IsNullOrEmpty(config["customDomain"]) ? req.Host.Host: config["customDomain"].ToString();
foreach (ShortUrlEntity url in result.UrlList)
{
url.ShortUrl = Utility.GetShortUrl(host, url.RowKey);
diff --git a/src/shortenerTools/UrlShortener/UrlShortener.cs b/src/shortenerTools/UrlShortener/UrlShortener.cs
index f2d70195..8a124e61 100644
--- a/src/shortenerTools/UrlShortener/UrlShortener.cs
+++ b/src/shortenerTools/UrlShortener/UrlShortener.cs
@@ -128,9 +128,7 @@ public static async Task Run(
await stgHelper.SaveShortUrlEntity(newRow);
- //var host = req.RequestUri.GetLeftPart(UriPartial.Authority);
- var host = req.Host.Host;
- log.LogInformation($"-> host = {host}");
+ var host = string.IsNullOrEmpty(config["customDomain"]) ? req.Host.Host: config["customDomain"].ToString();
result = new ShortResponse(host, newRow.Url, newRow.RowKey, newRow.Title);
log.LogInformation("Short Url created.");
diff --git a/src/shortenerTools/UrlUpdate/UrlUpdate.cs b/src/shortenerTools/UrlUpdate/UrlUpdate.cs
index 9caf1e4d..9961d5ed 100644
--- a/src/shortenerTools/UrlUpdate/UrlUpdate.cs
+++ b/src/shortenerTools/UrlUpdate/UrlUpdate.cs
@@ -115,8 +115,7 @@ public static async Task Run(
StorageTableHelper stgHelper = new StorageTableHelper(config["UlsDataStorage"]);
result = await stgHelper.UpdateShortUrlEntity(input);
- //var host = req.RequestUri.GetLeftPart(UriPartial.Authority);
- var host = req.Host.Host;
+ var host = string.IsNullOrEmpty(config["customDomain"]) ? req.Host.Host: config["customDomain"].ToString();
result.ShortUrl = Utility.GetShortUrl(host, result.RowKey);
}
diff --git a/src/shortenerTools/settings.json b/src/shortenerTools/settings.json
index d9a7606f..7670fba1 100644
--- a/src/shortenerTools/settings.json
+++ b/src/shortenerTools/settings.json
@@ -5,7 +5,7 @@
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"FUNCTIONS_V2_COMPATIBILITY_MODE":"true",
"UlsDataStorage":"",
- "defaultRedirectUrl":"https://azure.com"
-
+ "defaultRedirectUrl":"https://azure.com",
+ "customDomain":"https://c5m.ca"
}
}
diff --git a/src/shortenerTools/shortenerTools.csproj b/src/shortenerTools/shortenerTools.csproj
index 26d95204..cbe04a60 100644
--- a/src/shortenerTools/shortenerTools.csproj
+++ b/src/shortenerTools/shortenerTools.csproj
@@ -6,8 +6,8 @@
-
-
+
+