@jfitzi/vhost-cli-tool

0.1.1 • Public • Published

vhost-cli

A cli tool that lets you create and delete apache vhost files on the fly. Heavily inspired by the awesome RoverWire/virtualhost bash script I've been using for years.

Note Likely currently only works on Linux (I've only tested it on Ubuntu 20.04 so far). Currently, also only works with Apache2.

Usage

vhost create <name>

vhost delete <name>

All configurations can be overridden by flags and options, see vhost --help for details.

Configuration

The tool checks three paths for config files:

  1. /etc/vhost-cli.conf
  2. $HOME/vhost-cli.conf
  3. /home/(process.env.SUDO_USER || process.env.USER)/vhost-cli.conf

Each path overwriting the previous one.

The third path is mainly checked because during testing $HOME was set to /root instead of the calling users home dir.

Example config

{
	"serverAdmin": "admin@{name}.local",
	"serverName": "{name}.local",
	"serverAlias": "{name}.dev",
	"documentRoot": "/var/www/{name}/public",
	"projectRoot": "/var/www/{name}",
	"confName": "{name}.conf",
	"confPath": "/etc/apache2/sites-available",
	"templatePath": "/path/to/template.tmpl",
	"user": "your_username",
	"group": "www-data",
	"localIp": "127.0.0.1"
}

{name} can be used in any property and will be replaced by the name provided via cli.

user defaults to process.env.SUDO_USER || || process.env.USER

Package Sidebar

Install

npm i @jfitzi/vhost-cli-tool

Weekly Downloads

0

Version

0.1.1

License

GPL-3.0-or-later

Unpacked Size

19.2 kB

Total Files

17

Last publish

Collaborators

  • jfitzi