Skip to content

ingeniadevteam/clysema-dhcpcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@clysema/dhcpcd

npm (scoped) npm bundle size (minified)

Updates /etc/dhcpcd.conf and reboots the device.

Usage

This module is intended to be used with the @clysema/http module in order to enable a /dhcpcd post endpoint.

npm install @clysema/dhcpcd @clysema/http

Use an http module config/http.json like this:

"host": "0.0.0.0",
"root": "/home/pi/app/www",
"post": ["dhcpcd"]
}

Create an empty config file for the dhcpcd module (no config is needed but the file must exist).

touch config/dhcpcd.json

Then, somewere in the app loop:

try { await app.modules.dhcpcd(app); }
catch (e) { ... }

Test

Using auth (USERNAME= PASSWORD= npm start)

curl -d \
'{interface: "eth0", dhcp: true, ip_address: "", routers: "", domain_name_servers: ""}' \
-u <username>:<password> \
-H "Content-Type: application/json" \
-X POST http://<device_ip>:4000/dhcpcd

GUI

You can place a production build of the dhcpcd-ui package in the root configured folder (/home/pi/app/www in the above example) to be served by the app.

About

Updates `/etc/dhcpcd.conf` and reboots the device

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published