I'm configuring simple-httpd
so I can access my elfeed
remotely and would like to automatically detect the IP address of the host (since I use the config across machines and want to set it dynamically).
I found this old thread but C-h v network-
doesn't list network-interface-list
.
Is there a function I could leverage to get this or should I look at parsing output of ip a
in some manner?
EDIT :
Config I'm using for simple-httpd
is...
(use-package simple-httpd
:ensure t
:config
(setq httpd-host '"217.168.27.32")
(setq httpd-port '"8818"))
Since I run Emacs in daemon mode on a VPS my aim is to have it start simple-httpd
(via elfeed-web-start
) and then be able to point my browser (from anywhere) to the hostname and port I have associated with my VPS.
However, my Emacs config is shared across machines and if my VPS goes down I'd like to be able to point to a device on my home network that also runs Emacs in daemon mode and access that (it has a static IP on the home network, I have a static IP from my ISP and have a DNS entry for that and I can port forward requests to the correct device).
Hence the sharing of configuration across devices means I'd like to dynamically set the httpd-host
for simple-httpd
.
I can as suggested get the system-name
(although help indicates its obsolete and to use (system-name)
instead), so its presumably then a case of setting the static IP address' I have conditional on this value by the sounds of it.