Uh oh!
There was an error while loading. Please reload this page.
modules: introduce hostctl (static dns for development) - #75
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| # TODO: Uninstall when leaving the devshell | ||
| # trap uninstall EXIT |
There was a problem hiding this comment.
This seems hard to get right, particularly because when the user runs two dev-shells and exits one.
Modifying the system is a bit heavy-handed for a development shell. I was secretly hoping for an unprivileged solution when I saw this PR. Perhaps (userns) containers are a more appropriate solution for most use cases.
There was a problem hiding this comment.
There is indeed a long term heavily politically involved solution to this: https://github.com/apetresc/nss-hostslocal. That would require lobbying for changing the way how linux system generally resolve hostfiles these days.
This particular PR is not going to get merged for this reason.
However, in a dev team setting, where you can exert certain powers over an individual's machine, this is a solution that (somewhat) works.
zimbatm
commented
Dec 13, 2021
Do you think this PR is worth pursuing? It would need to have some tests. |
blaggacao
commented
Dec 15, 2021
It might. I can try to free some time in the next few month, please keep nudging in case I'm not reactive 😄 |
bobvanderlinden
commented
Aug 24, 2022
Have you considered using something like userhosts? https://github.com/figiel/hosts I packaged it in the past for the purpose of using it inside a shell. It uses ldpreload to override a number of the DNS resolving functions. It doesn't need root and is basically set/reset using envvars. That said, at the moment it doesn't support osx. Also, if you have a webbrowser open already, it won't pick up the new hosts, as they are only available within the shell. |
bobvanderlinden
commented
Sep 29, 2022
I created #225 based on libuserhosts as a different implementation of configuring hosts entries. |
hostctl module allows to temporarily set static dns entries for development per project
What we get: