[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Examples of local-host-entries or hosts-service-type?
From: |
Remco van 't Veer |
Subject: |
Re: Examples of local-host-entries or hosts-service-type? |
Date: |
Thu, 02 Mar 2023 09:47:45 +0100 |
User-agent: |
mu4e 1.8.13; emacs 28.2 |
Hi Bruno,
2023/03/02 02:41, Bruno Victal:
> On 2023-02-27 06:23, Remco van 't Veer wrote:
>>
>> Or when you want to provide extra aliases for localhost?
>>
>> Like this?
>>
>> (essential-services
>> (modify-services
>> (operating-system-default-essential-services this-operating-system)
>> (hosts-service-type config =>
>> (list (host "127.0.0.1" "localhost" (list host-name
>> "foo" "bar"))
>> (host "::1" "localhost" (list host-name
>> "foo" "bar"))))))
>
> Semantically you're right though I wouldn't outright do this unless it
> results in clearer code or if its really needed.
>
> Reason for this is that the format of /etc/hosts isn't consistently
> defined.
> For instance, there is a limit on the maximum number of
> aliases. (depending on the implementation)
>
> If I wanted to add extra aliases, I'd extend the service with new
> "standalone" host records instead though your snippet is just as
> valid, as long you don't go overboard with the number of aliases.
I not sure all applications will react well to having multiple entries
for the same IP-address.
>From the hosts(5) manpage:
> This file is a simple text file that associates IP addresses with
> hostnames, one line per IP address.
To workaround the alias limit, picking multiple loopback addresses (for
the example above) would be a better solution, it seems.
Cheers,
Remco