1- namespace LearningHub . Nhs . WebUI . Startup
1+ using TELBlazor . Components . Core . Configuration ;
2+
3+ namespace LearningHub . Nhs . WebUI . Startup
24{
3- using System ;
4- using System . Net . Http ;
55 using Blazored . LocalStorage ;
66 using GDS . MultiPageFormData ;
77 using LearningHub . Nhs . Models . OpenAthens ;
1919 using Microsoft . Extensions . Configuration ;
2020 using Microsoft . Extensions . DependencyInjection ;
2121 using Microsoft . Extensions . Hosting ;
22+ using System ;
23+ using System . Net . Http ;
2224 using TELBlazor . Components . Core . Configuration ;
2325 using TELBlazor . Components . Core . Services . HelperServices ;
26+ using static System . Net . Mime . MediaTypeNames ;
2427
2528 /// <summary>
2629 /// The service mappings.
@@ -156,6 +159,12 @@ public static void AddLearningHubMappings(this IServiceCollection services, ICon
156159 var context = httpContextAccessor . HttpContext ;
157160 bool jsEnabled = false ;
158161
162+ var environment = builder . Configuration [ "Environment" ] ;
163+
164+ // Azure cant have differing application values so we default to assembly name if not set
165+ var application = builder . Configuration [ "Properties:Application" ] ??
166+ typeof ( Program ) . Assembly . GetName ( ) . Name ;
167+
159168 if ( context != null && context . Request . Cookies . TryGetValue ( "jsEnabled" , out var jsCookieValue ) )
160169 {
161170 jsEnabled = jsCookieValue == "true" ;
@@ -164,11 +173,11 @@ public static void AddLearningHubMappings(this IServiceCollection services, ICon
164173 return new TELBlazorBaseComponentConfiguration
165174 {
166175 JSEnabled = jsEnabled ,
167- HostType = $ "{ configuration [ "Environment" ] } { configuration [ "Properties:Application" ] } ",
176+ HostType = $ "{ environment } { application } ",
168177 } ;
169178 } ) ;
170179
171180 services . AddScoped < ILogLevelSwitcherService , NLogLogLevelSwitcherService > ( ) ;
172181 }
173182 }
174- }
183+ }
0 commit comments