diff --git a/src/NuGet.Server/Controllers/PackagesODataController.cs b/src/NuGet.Server/Controllers/PackagesODataController.cs index f68cea59..0862d9f3 100644 --- a/src/NuGet.Server/Controllers/PackagesODataController.cs +++ b/src/NuGet.Server/Controllers/PackagesODataController.cs @@ -29,7 +29,7 @@ protected PackagesODataController(IServiceResolver serviceResolver) // Exposed through ordinary Web API route. Bypasses OData pipeline. public async Task ClearCache(CancellationToken token) { - if (RequestContext.IsLocal) + if (RequestContext.IsLocal || ServiceResolver.Current.Resolve().GetBoolSetting("allowRemoteCacheManagement", false)) { await _serverRepository.ClearCacheAsync(token); return CreateStringResponse(HttpStatusCode.OK, "Server cache has been cleared."); diff --git a/src/NuGet.Server/Core/DefaultServiceResolver.cs b/src/NuGet.Server/Core/DefaultServiceResolver.cs index dae8fabb..5a0bc947 100644 --- a/src/NuGet.Server/Core/DefaultServiceResolver.cs +++ b/src/NuGet.Server/Core/DefaultServiceResolver.cs @@ -53,6 +53,11 @@ public object Resolve(Type type) return _packageAuthenticationService; } + if (type == typeof(ISettingsProvider)) + { + return _settingsProvider; + } + return null; } diff --git a/src/NuGet.Server/Default.aspx b/src/NuGet.Server/Default.aspx index ff321801..feeff083 100644 --- a/src/NuGet.Server/Default.aspx +++ b/src/NuGet.Server/Default.aspx @@ -34,7 +34,7 @@ <% } %> - <% if (Request.IsLocal) { %> + <% if (Request.IsLocal || ServiceResolver.Current.Resolve().GetBoolSetting("allowRemoteCacheManagement", false)) { %>
Adding packages diff --git a/src/NuGet.Server/NuGet.Server.csproj b/src/NuGet.Server/NuGet.Server.csproj index d414adaf..5f1c2c11 100644 --- a/src/NuGet.Server/NuGet.Server.csproj +++ b/src/NuGet.Server/NuGet.Server.csproj @@ -174,16 +174,7 @@ - True - True - 1425 - / - http://localhost:40221/ - False - False - - - False + True diff --git a/src/NuGet.Server/Web.config b/src/NuGet.Server/Web.config index 6be09215..a039929d 100644 --- a/src/NuGet.Server/Web.config +++ b/src/NuGet.Server/Web.config @@ -69,6 +69,8 @@ on a fixed 1-hour interval. --> + +