/// <summary> /// Add preflight-specific values to the servervariables dictionary /// </summary> /// <param name="sender"></param> /// <param name="dictionary"></param> private static void ServerVariablesParser_Parsing(object sender, Dictionary <string, object> dictionary) { var urlHelper = new System.Web.Mvc.UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); dictionary.Add("Stately", new Dictionary <string, object> { { "ApiPath", urlHelper.GetUmbracoApiServiceBaseUrl <SettingsApiController>(controller => controller.Get()) } }); }
/// <summary> /// Add preflight-specific values to the servervariables dictionary /// </summary> /// <param name="sender"></param> /// <param name="dictionary"></param> private static void ServerVariablesParser_Parsing(object sender, Dictionary <string, object> dictionary) { var urlHelper = new System.Web.Mvc.UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); IDictionary <string, object> settings = dictionary["umbracoSettings"].ToDictionary(); dictionary.Add("Preflight", new Dictionary <string, object> { { "ContentFailedChecks", KnownStrings.ContentFailedChecks }, { "PluginPath", $"{settings["appPluginsPath"]}/preflight/backoffice" }, { "PropertyTypesToCheck", KnownPropertyAlias.All }, { "ApiPath", urlHelper.GetUmbracoApiServiceBaseUrl <Api.ApiController>(controller => controller.GetSettings()) } }); }
private void InstallServerVars() { // register our url - for the backoffice api ServerVariablesParser.Parsing += (sender, serverVars) => { if (!serverVars.ContainsKey("umbracoUrls")) { throw new Exception("Missing umbracoUrls."); } var umbracoUrlsObject = serverVars["umbracoUrls"]; if (umbracoUrlsObject == null) { throw new Exception("Null umbracoUrls"); } if (!(umbracoUrlsObject is Dictionary <string, object> umbracoUrls)) { throw new Exception("Invalid umbracoUrls"); } if (!serverVars.ContainsKey("umbracoPlugins")) { throw new Exception("Missing umbracoPlugins."); } if (!(serverVars["umbracoPlugins"] is Dictionary <string, object> umbracoPlugins)) { throw new Exception("Invalid umbracoPlugins"); } if (HttpContext.Current == null) { throw new InvalidOperationException("HttpContext is null"); } var urlHelper = new System.Web.Mvc.UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); umbracoUrls[StandingData.ApplicationName] = urlHelper.GetUmbracoApiServiceBaseUrl <StaticSiteGeneratorController>(controller => controller.Startup()); }; }