jsr-conf v0.3.22
Table of Contents
Configuration Module
Read and write redis configuration files.
Component of the jsr library.
Install
npm i jsr-conf
API
var Configuration = require('jsr-conf').Configuration
, conf = new Configuration()
, opts = {file: 'redis.conf'};
conf.once('error', function onError(err) {
console.error(err.message);
process.exit(1);
});
conf.load(opts, function onLoad() {
console.log('confguration loaded: %s', this.getFile());
});
Options
The load
method accepts an options
object with the following properties:
file
: Path to the configuration file to load (string).stdin
: When set thefile
option is ignored and the configuration is read fromprocess.stdin
(boolean).directives
: Configuration directives map (object).
Directives
The directives
are parsed by the configuration loader once the configuration file (and all includes) have been loaded and parsed, this object can be used to override the configuration from command line arguments.
The directives
fields are subject to the same validation rules as directives loaded from configuration file(s) and should follow the same format, for example:
{
rdbcompression: 'no'
}
Would be considered valid, however:
{
rdbcompression: false
}
Generates an error event.
Configuration
Configuration directive support.
The list of directives that may be set via CONFIG SET
at runtime are defined in runtime.js.
include
: Include files are loaded and parsed, circular include references will result in an error.daemonize
: The server will spawn a detached process running as a daemon.pidfile
: When running as a daemon the server will attempt to write a pid file to the location specified by this directive, a warning is printed if the pid file could not be written.port
: The port to listen on, if zero the server will not listen on a TCP port.tcp-backlog
: Respected when the server callslisten()
.bind
: Not implemented.unixsocket
: Server will bind to the socket file.unixsocketperm
: Server will set permissions on the socket file.timeout
: Closes idle client connections after the specified number of seconds.tcp-keepalive
: Not implemented.loglevel
: Set the server log level.logfile
: Write log messages to a file, when this is the empty string log messages are printed tostdout
except log messages with thewarning
level which are printed tostderr
. When the server is running as a daemon and this is the empty string, logs are redirected to/dev/null
.syslog-enabled
: Not implemented.syslog-ident
: Not implemented.syslog-facility
: Not implemented.databases
: Set the number of databases.save
: Not implemented.stop-writes-on-bgsave-error
: Not implemented.rdbcompression
: Not implemented.rdbchecksum
: Not implemented.dbfilename
: The filename where to dump the db.dir
: The working directory.slaveof
: Not implemented.masterauth
: Not implemented.slave-serve-stale-data
: Not implemented.slave-read-only
: Not implemented.repl-diskless-sync
: Not implemented.repl-diskless-sync-delay
: Not implemented.repl-ping-slave-period
: Not implemented.repl-timeout
: Not implemented.repl-disable-tcp-nodelay
: Not implemented.repl-backlog-size
: Not implemented.repl-backlog-ttl
: Not implemented.slave-priority
: Not implemented.min-slaves-to-write
: Not implemented.min-slaves-max-lag
: Not implemented.requirepass
: Respected when set, clients must successfullyAUTH
before executing any other commands.rename-command
: Implemented, when the second parameter is the empty string the command is deleted otherwise the command is renamed.maxclients
: Implemented, the server will reject client connections whenmaxclients
is reached.maxmemory
: Not implemented.maxmemory-policy
: Not implemented.maxmemory-samples
: Not implemented.appendonly
: Not implemented.appendonlyfilename
: Not implemented.appendfsync
: Not implemented.no-appendfsync-on-rewrite
: Not implemented.auto-aof-rewrite-percentage
: Not implemented.auto-aof-rewrite-min-size
: Not implemented.aof-load-truncated
: Not implemented.lua-time-limit
: Respected by the script module.slowlog-log-slower-than
: Respected at boot time and viaCONFIG SET
.slowlog-max-len
: Respected at boot time and viaCONFIG SET
.latency-monitor-threshold
: Not implemented.notify-keyspace-events
: Not implemented.hash-max-ziplist-entries
: Not implemented.hash-max-ziplist-value
: Not implemented.list-max-ziplist-entries
: Not implemented.list-max-ziplist-value
: Not implemented.set-max-intset-entries
: Not implemented.zset-max-ziplist-entries
: Not implemented.zset-max-ziplist-value
: Not implemented.hll-sparse-max-bytes
: Not implemented.activerehashing
: Not implemented.client-output-buffer-limit
: Not implemented.hz
: The server uses this value for certain periodic tasks such as passive key expiry.aof-incremental-fsync
: Not implemented.
Developer
Test
Tests are not included in the package, clone the repository:
npm test
Import
To import the default values from redis.conf
to the map of defaults
run:
npm run import
When importing a new file the only value that should be changed is the port
which is reversed from 6379
to 9736
.
Documentation
To generate all documentation:
npm run docs
Readme
To build the readme file from the partial definitions (requires mdp):
npm run readme
License
Everything is MIT. Read the license if you feel inclined.
Generated by mdp(1).