Home

Awesome

setup

A server config utility for nodejs Change: hostname, network interfaces, hosts and date/time

Features

You need to install wpasupplicant for wireless options

Install

npm install setup

API

Networking

KeyDescription
setup.network.config(option)Generate a new network config file
setup.network.save(config, outFile)Saves the configuration
setup.network.restart()Restart network interfaces

Hostname

KeyDescription
setup.hosts.save(hostname, outFile)Saves the configuration

Hosts (dns)

KeyDescription
setup.hosts.config(hosts)Generate a new hosts config file
setup.hosts.save(config, outFile)Saves the configuration

Date/Time

KeyDescription
setup.clock.set(time)Set date/time and sync BIOS clock

Examples

Set network interfaces

This will set your wlan0 card to connect at boot, use dhcp for ip settings, e connect to the SSID 'myWirelessName'. Your ethernet card will have a static ip.

var setup = require('setup')();

var config = setup.network.config({
	wlan0: {
		auto: true, // start at Boot
		dhcp: true, // Use DHCP
		wireless: {
			ssid: 'myWirelessName', // Wireless SSID
			psk: 'mySuperPassword', // Password
		}
	},
	eth0: {
		auto: true,
		ipv4: {
			address: '192.168.1.20',
			netmask: '255.255.255.0',
			gateway: '192.168.1.1',
			dns: '8.8.8.8'
		}
	}
});

setup.network.save(config);

Change Hostname

setup.hostname.save('nodejs.example.com');

Change hosts

var hosts = setup.hosts.config({ 
	'10.0.0.1':'server1.example.com', 
	'10.0.0.2':'server2.example.com'
});

setup.hosts.save(hosts);