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

A way to customize cacheable-lookup #1058

Closed
Kikobeats opened this issue Feb 9, 2020 · 3 comments · Fixed by #1051
Closed

A way to customize cacheable-lookup #1058

Kikobeats opened this issue Feb 9, 2020 · 3 comments · Fixed by #1051
Labels
enhancement This change will extend Got features ✭ help wanted ✭

Comments

@Kikobeats
Copy link
Contributor

Hello,

I noted dnsCache is used only for setup cache adapter at cacheable-lookup:

options.dnsCache = new CacheableLookup({cacheAdapter: options.dnsCache as Keyv});

Since I'm interested in customize some cacheable-lookup capabilities, (such as resolver) I want to ask if you will accept a way for passing a cacheable-lookup instance as dnsCache to be used 🙂

@szmarczak szmarczak added enhancement This change will extend Got features ✭ help wanted ✭ labels Feb 9, 2020
@szmarczak szmarczak mentioned this issue Feb 9, 2020
18 tasks
@szmarczak
Copy link
Collaborator

This is already fixed in #1051, but I don't think it'll be merged this month. Also I don't have much time now, so my work is strictly focused on #1051. Anyway, PRs are welcome :)

@szmarczak
Copy link
Collaborator

For now you can do this:

const instance = got.extend({
	dnsCache: new Map(),
	mutableDefaults: true
});

instance.defaults.options.dnsCache._resolver.setServers([
    '1.1.1.1',
    '8.8.8.8'
]);

@Kikobeats
Copy link
Contributor Author

Kikobeats commented Feb 10, 2020

wow #1051 is huge, if you think this is resolved there then that's great

The workaround is enough until #1051 land 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features ✭ help wanted ✭
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants