Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Remove usage of PlatformAbstractions #192

Merged
merged 2 commits into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/NugetSymbolServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -17,7 +16,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host
{
Configuration =
new ConfigurationBuilder()
.SetBasePath(ApplicationEnvironment.ApplicationBasePath)
.SetBasePath(AppContext.BaseDirectory)
.Add(hostProvidedConfiguration)
.AddJsonFile("config.json", optional: hostingEnvironment.IsDevelopment())
.AddJsonFile($"config.{hostingEnvironment.EnvironmentName}.json", optional: true)
Expand All @@ -28,7 +27,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host

LoggingConfiguration =
new ConfigurationBuilder()
.SetBasePath(ApplicationEnvironment.ApplicationBasePath)
.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("logging.json", optional: true)
.AddJsonFile($"logging.{hostingEnvironment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables()
Expand All @@ -52,7 +51,7 @@ public void ConfigureServices(IServiceCollection services)
throw new Exception("No configuration specified for FileCache:CachePath");
}
cachePath = Environment.ExpandEnvironmentVariables(cachePath);
options.RootPath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, cachePath);
options.RootPath = Path.Combine(AppContext.BaseDirectory, cachePath);
})
.Configure<DirectoryPackageSourceOptions>(options =>
{
Expand All @@ -62,7 +61,7 @@ public void ConfigureServices(IServiceCollection services)
throw new Exception("No configuration specified for PackageSource:SourcePath");
}
sourcePath = Environment.ExpandEnvironmentVariables(sourcePath);
options.SourcePath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, sourcePath);
options.SourcePath = Path.Combine(AppContext.BaseDirectory, sourcePath);
})
.AddSingleton<IFileStore, FileStore>()
.AddSingleton<ISymbolAccess, PackageBasedSymbolStore>()
Expand All @@ -88,4 +87,4 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
app.UseStaticFiles();
}
}
}
}