New issue 322 by pc.reader00: Can't configure server parameters from
command line (with patch)
http://code.google.com/p/redis/issues/detail?id=322
What steps will reproduce the problem?
redis-server currently reads configuration directives from a config file
specified on the command line. It would be convenient to be able to be able
to configure the server from the command line using standard --option=value
syntax however this is not currently supported (a note in the config.c file
suggests that there is an intent to change this at some point)
Note: it is possible to configure options using a "here-doc"
What is the expected output? What do you see instead?
./redis-server --port=9999 (etc)
Sets appropriate configutation options
What version of the product are you using? On what operating system?
git head - Mac OS-X
Redis server version 2.1.4 (556bdfba:1)
Please provide any additional information below.
A patch which enables '--option=value' support is attached below. This is
actually pretty simple - it moves the current option parsing logic into a
separate function which can be called either by the config file parser and
adds a simple cli argument parser which extracts configuration options and
dynamically passes them to the option parser - this ensures that we don't
have to define the logic twice or hardcode the options into the cli parser
(as would be needed by getopt-long)
Attachments:
cli-options.diff 19.9 KB
Comment #1 on issue 322 by antirez: Can't configure server parameters from
command line (with patch)
http://code.google.com/p/redis/issues/detail?id=322
Hello, this is the Redis way of doing it:
echo "port 8888" | ./redis-server -
Cheers,
Salvatore