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

x/crypto/acme/autocert: expose cacheDir function #21151

Open
bradrydzewski opened this issue Jul 24, 2017 · 2 comments

Comments

@bradrydzewski
Copy link

commented Jul 24, 2017

I would like the ability to use the default cache directory logic in situations where I have to create a custom cert manager, however, it is currently a private function. Would a change to expose this logic be accepted?

Reference code: https://github.com/golang/crypto/blob/6914964337150723782436d56b3f21610a74ce7b/acme/autocert/listener.go#L142

@gopherbot gopherbot added this to the Unreleased milestone Jul 24, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

I'd rather not.

This is an ACME cert package, not a filesystem path package.

Stuff like https://godoc.org/go4.org/xdgdir exists to return conventional paths.

@bradrydzewski

This comment has been minimized.

Copy link
Author

commented Jul 24, 2017

Thanks for the quick reply!

This is an ACME cert package, not a filesystem path package.

To clarify I am less interested in the path string value, and more interested in obtaining a DirCache with default path logic when I am unable to use NewListener.

Something like this:

manager := autocert.Manager{
	Prompt:     autocert.AcceptTOS,
	HostPolicy: autocert.HostWhitelist(address.Host),
+	Cache:      autocert.DirCacheFromEnv(),
}

The cacheDir function includes some additional logic for windows and falls back to the home directory. I was looking for a consistent way to cache certificates regardless of how autocert.Manager is created, but certainly understand if there is no interest in exposing these internals.

Stuff like https://godoc.org/go4.org/xdgdir exists to return conventional paths.

Thanks for the link, I will investigate further to see if I can use in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.