Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable cache file name #49

Merged
merged 11 commits into from
Feb 3, 2018

Conversation

apeneve
Copy link
Contributor

@apeneve apeneve commented Jan 24, 2018

Background for pull request: I have two nuget server sites sharing the same package repository folder. One public with authentication, and one internal. In this scenario I get file lock errors on the cache file, so I need to be able to configure different cache files for each site.

joelverhagen and others added 4 commits November 30, 2017 13:05
Handy when you have configured two feeds pointing to the same packages
folder.
@dnfclas
Copy link

dnfclas commented Jan 24, 2018

CLA assistant check
All CLA requirements met.

@joelverhagen
Copy link
Member

@apeneve, sorry about the delay. Thanks for the contribution. I'm taking a look at this now!

@joelverhagen joelverhagen self-assigned this Feb 1, 2018
@@ -22,6 +22,11 @@
-->
<add key="packagesPath" value="" />

<!--
Change the name of the internal cache file. Default is machine name (System.Environment.MachineName).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear whether putting a path here works (or even should work).

I would recommend updated the XML comment to state that this must be a file name and not a relative or absolute path. Additionally, I would validate at runtime that this is just a file name. In the future we could extend this to support relative paths but that seems unnecessary now and can be expanded without being a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I updated the XML comment and added validation of a valid file name.

}

if (fileName.EndsWith(suffix, StringComparison.OrdinalIgnoreCase))
return fileName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: curly { } around all if blocks, even if one line.

readonly Func<string, bool, bool> _getSetting;
internal FuncSettingsProvider(Func<string,bool,bool> getSetting)
readonly Func<string, object, object> _getSetting;
internal FuncSettingsProvider(Func<string,object,object> getSetting)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpic: spaces between type parameters after the comma ,

Copy link
Member

@joelverhagen joelverhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome so far! Thanks for extending the settings provider to allow more generic settings. Please take a look at my feedback.

@joelverhagen
Copy link
Member

Could you add some unit or integration test that verified this behavior? I'm thinking something that verifies that if the this setting is provided, the cache file appears in the packages directory (File.Exists or something).

@apeneve
Copy link
Contributor Author

apeneve commented Feb 2, 2018

@joelverhagen I fixed up the nitpic comments and extended the XML comment a bit. I also added some tests to the ServerPackageRepository class to describe the different cache file name scenarios.

@joelverhagen
Copy link
Member

@apeneve, wonderful! I'll work on merging this and shipping this as a 3.1.0 package.

@joelverhagen joelverhagen merged commit 44ce576 into NuGet:dev Feb 3, 2018
@apeneve apeneve deleted the Configurable-cache-file-name branch February 4, 2018 19:57
@joelverhagen joelverhagen mentioned this pull request Feb 5, 2018
@joelverhagen
Copy link
Member

@apeneve, this is available as 3.1.0 on nuget.org:
https://www.nuget.org/packages/NuGet.Server/3.1.0

@apeneve
Copy link
Contributor Author

apeneve commented Feb 5, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants