_____ ___ _ _ _____ ___|_ _/ _ \| \| |_ _/ _ \| || (_) | .` | | || (_) ||_| \___/|_|\_| |_| \___/.JSAPACHE CONFIG FILE GENERATOR
Additionally, Tonto is easily configured at instantiation to support any custom directive that you may have, (such as 3rd-party mod directives like 'PassengerRoot').
This library is named after the Tonto (Dilzhę́’é) people, who are one of the Western Apache groups in North America.
Long ago, their enemies called them "foolish", "wild", "crazy", and "those who you don't understand" for speaking and doing things differently than their neighbors. Today, they are known throughout the art communities for their superior fine crafts.
Use NPM to install the
tonto package into your node.js project:
$ npm install tonto --save
1. Each instance of Tonto is a version-specific apache config document object that you add directives to by calling it's directive functions:
var tonto = '2.4';
2. There are solo directive functions that take a single value argument, and block directive functions which take a sub-directive setter object as the second argument:
3. When the document object has all directives added to it, you can render the document to string by calling:
4. All directives are chainable:
var renderedDocument = tonto;
Tonto.js comes with built-in support for all native (and native mod) directives in versions 2.4, 2.2, and 2.0. Additionally, you can specify any number of extra directives.
You specify which version you want to use during instantiation of the constructor:
var twoFour = ;Objectlength; // 594var twoTwo = ;Objectlength; // 419var twoZero = ;Objectlength; // 364
Whereas Apache directives are typed in TitleCase, tonto converts each of the directives into camelBackCase named functions.
LoadModuleis added to the document with:
SSLCertificateKeyFileis added to the document with:
VirtualHostis added to the document with:
Block directives require a function as the second argument. This function has one argument itself, which is a clean sub-document. You can call any directive from the main document on a sub-document.
Here is an example of a sub-directive setter defined as a named function:
This example will render:
<VirtualHost *:80>ServerName somesite.com</VirtualHost>
If you are using a 3rd party mod that provides custom directives, there is an easy way to extend tonto.js with custom functions for this purpose:
tonto;tonto; // Solo directivetonto;