Skip to content

How to get cache when using default config? #307

@teleclimber

Description

@teleclimber

What is your question?

I am upgrading to the latest certmagic, and have to adjust my code given the loss of Config.Unmanage(). In my simple use of certmagic I create it using certmagic.NewDefault(), meaning I don't create the cache in my code.

The release notes say I should replace Unmanage with Cache.RemoveManaged(). But I don't have the cache.

I looked at the docs and I don't see a getter for the cache in Config.

What have you already tried?

I could try creating a default cache myself, stashing a pointer to it, and using that when I need to stop managing a cert. But that would defeat the convenience of NewDefault.

I am wondering if I missed something, or if there should maybe be a getter for the Cache in Config. Or it could be exported? It's the only non-exported field in the config.

Bonus: What do you use this package for, and does it help you?

I'm happily using certmagic in my project Dropserver.

https://github.com/teleclimber/Dropserver/blob/9585ea716ba59ddb3feeab09ff10841238be1af0/cmd/ds-host/certificatemanager.go/certificatemanager.go#L108

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions