/// <summary> /// Returns a specified environment configuration as the current webapp's /// default configuration during the runtime. /// </summary> internal static IEnvironment GetEnvironment(IHostingEnvironment hostingEnvironment, IFileSystemPathProvider fileSystemPathsProvider, IDeploymentSettingsManager settings = null, IHttpContextAccessor httpContextAccessor = null) { var root = PathResolver.ResolveRootPath(); var siteRoot = Path.Combine(root, Constants.SiteFolder); var repositoryPath = Path.Combine(siteRoot, settings == null ? Constants.RepositoryPath : settings.GetRepositoryPath()); var binPath = AppContext.BaseDirectory; var requestId = httpContextAccessor?.HttpContext.Request.GetRequestId(); var kuduConsoleFullPath = Path.Combine(AppContext.BaseDirectory, KuduConsoleRelativePath, KuduConsoleFilename); return(new Environment(root, EnvironmentHelper.NormalizeBinPath(binPath), repositoryPath, requestId, kuduConsoleFullPath, httpContextAccessor, fileSystemPathsProvider)); }
public static IEnvironment GetEnvironment(IHostingEnvironment hostingEnvironment, IDeploymentSettingsManager settings = null, HttpContext httpContext = null) { var root = PathResolver.ResolveRootPath(); var siteRoot = Path.Combine(root, Constants.SiteFolder); var repositoryPath = Path.Combine(siteRoot, settings == null ? Constants.RepositoryPath : settings.GetRepositoryPath()); // CORE TODO see if we can refactor out PlatformServices as high up as we can? var binPath = AppContext.BaseDirectory; var requestId = httpContext?.Request.GetRequestId(); // CORE TODO Clean this up var kuduConsoleFullPath = Path.Combine(AppContext.BaseDirectory, hostingEnvironment.IsDevelopment() ? @"..\..\..\..\Kudu.Console\bin\Debug\netcoreapp2.2" : KuduConsoleRelativePath, KuduConsoleFilename); //kuduConsoleFullPath = Path.Combine(System.AppContext.BaseDirectory, KuduConsoleRelativePath, KuduConsoleFilename); // CORE TODO Environment now requires an HttpContextAccessor, which I have set to null here return(new Core.Environment(root, EnvironmentHelper.NormalizeBinPath(binPath), repositoryPath, requestId, kuduConsoleFullPath, null)); }