## Feature Description
Currently, If a user wishes to customize their runtime configurations
the only way to do so is by passing in arguments via commandline
parameters each time the service is started. Since these options are
unlikely to change for an individual user, a configuration file able to
be parsed at runtime to set these options can be added to the
CouchPotatoServer application root directory. Once configured, the user
no longer has to pass any arguments via the commandline.
## Config File Setup
An example template for users too customize can be found at
`CouchPotatoServer/init/runtime_config.ini`
An example configuration:
```
[default]
daemon:
data_dir: /home/couchpotato
config_file: /etc/couchpotato/settings.conf
pid_file: /home/couchpotato/cp.pid
```
This example is equivilant to executing:
```
python CouchPotato.py --daemon \
--data_dir /home/couchpotato \
--config_file /etc/couchpotato/settings.conf \
--pid_file /home/couchpotato/cp.pid
```
For boolean parameters such as --daemon or --debug, provide just the
name of the option on its own line with or without the ":" on the end.
Parameters that have corresponding arguments require the name of the
parameter, a ":", followed by a space and the argument to be passed in.
Lines beginning with a # are considered comments and not parsed.
## Note
Parameters passed as command line arguments WILL take precedence over
the one specified in the config.ini file.
## Changes
* added package argparse_config.py to the lib folder
* Modified runner.py to parse config.ini file
* Added config.ini file which sets daemon mode by default
* Added init/runtime-config.ini which contains all available options with comments
Previously any exception that made it all the way up to the default
exception handler would be expected to take (errno, string) pairs,
as is the python standard for exceptions thrown by system calls.
All exceptions that don't take enough arguments throw a ValueError.
Based on the errno tested, it appears that this code
is meant to silently ignore when a socket receives a SIGINT (from
e.g. a timeout.) This seems to be the only instance where handling
EINTR in this manner is desired - though having this bubble up this
far seems odd.
The existing code would also handle any other EINTR, though, which
includes those raised by OSError, WindowsError, and
anything that subclasses EnvironmentError, barring KeyboardError
because it is handled separately. This is a bug as there is already
some use of the signals module elsewhere in CouchPotato.py to trap
SIGINT and SIGTERM outside of system calls, and most of these other
EINTRs should be handled by code lower down the stack.
A default exception handler is also added, so that unhandled
exceptions will be logged, and raised.