| Crates.io | eha |
| lib.rs | eha |
| version | 0.3.0 |
| created_at | 2025-02-04 13:37:45.70789+00 |
| updated_at | 2025-02-04 13:37:45.70789+00 |
| description | etc-hosts adder for localhost development domains |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1541936 |
| size | 30,705 |
eha the /etc/hosts adderThis is a personal tool I use to quickly add *.local/*.localhost DNS entries to my /etc/hosts file to support local testing without needing to run a local BIND/DNSMASQ process. Each entry becomes eligible for cleanup after some expiry time (default 24h).
It has a very simple UX, to add a record:
eha add myapp.local
eha add myapp.local -e 60
curl http://myapp.local -v
* Host myapp.local:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
* Trying 127.0.0.1:80...
...
Remove a record:
eha remove myapp.local
curl http://myapp.local -v
* Could not resolve host: myapp.local
Note that both add, remove, and remove-expired will drop any items that are past their expiry time.
By default, this will read /etc/hosts and write to it afterwards, but, you can use --file to change the subject file, and --test to print the result to stdout without overwriting the file.
cargo install eha