Skip to content

hugorodrigues/setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup

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

Features

  • Set your network configuration. supports wireless adapters
  • Change your hostname
  • Set your hosts file (local dns)
  • Modify server date/time and BIOS update
  • Only works in linux :)

You need to install wpasupplicant for wireless options

Install

npm install setup

API

Networking

Key Description
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

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

Hosts (dns)

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

Date/Time

Key Description
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);

About

Nodejs system setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published