Table of Contents

Config

This module exports configuration of the Hop server running instance.

require( require( 'hop' ).config ) to use the module.

Autoconf

The following read-only properties are established when Hop is configured.

config.shareDir

The share directory of the Hop installation.

console.log( "share:", config.shareDir );

config.binDir

The bin directory of the Hop installation.

console.log( "bin:", config.binDir );

config.libDir

The lib directory of the Hop installation.

console.log( "lib:", config.libDir );

config.modulesDir

The `modules` directory of the Hop installation._node

console.log( "modules:", config.modulesDir );

Initialization Settings

The server properties defined below are set either in the Hop.js launch arguments or in the hoprc.js configuration file, before the implicit http server is activated. Setting the properties later would have no effect on the running http server.

Values specified in the hoprc.js file overwrite command line arguments.

config.HTTPPort

config.HTTPSPort

These two properties are read-only. Their values are defined after command line arguments. These properties specify which protocol is activated (default is HTTP) and the port number for this protocol. Currently, at least one property has the value undefined as a Hop.js server cannot run both protocols in a single instance.

When the special value 0 was given at launch time for either property, the system randomly selects an available port and sets the property accordingly.

The hop.portproperty is equal to config.HTTPPortif this property is defined, or to config.HTTPSPort.

var hop = require( 'hop' );
var config = require( hop.config );
if ( config.HTTPSPort ) {
        console.log( 'Server is running HTTPS on port:', config.HTTPSPort );
};

config.serverAliases

The server known aliases. This parameter is used to separate local requests from remote requests.

console.log( "server aliases:", config.serverAliases );

config.HTTPAuthentication

Hop's authentication mode. Can either be basic or digest. These two modes are described in the RFC 7235 https://tools.ietf.org/html/rfc7235.

config.HTTPSPrivateKey

The path of the private key when https is enabled.

console.log( "https private key:", config.HTTPSPrivateKey );

config.HTTPSCertificate

The path of the certificate when https is enabled.

console.log( "https private key:", config.HTTPSCertificate );

config.maxThreads

Maximum number of native threads used by the server.

console.log( "threads:", config.maxThreads );

config.xmlBackend

Default HTML backend for generating document.

console.log( "html:", config.xmlBackend );

config.enableWebdav

Enable or disable Webdav support.

console.log( "webdav:", config.enableWebdav );

config.enableKeepAlive

Enable or disable Keepalive support.

console.log( "keep-alive:", config.enableKeepAlive );

Global configuration

The following properties describe the state of the running Hop. They can be changed dynamically.

config.locale

The locale of the host running the Hop server.

config.charset

The character set used to compile XML nodes into HTML.