parser.add_option("-t", "--tracebacks", help="Display tracebacks in error pages (this reveals a LOT of information, do NOT use in production!)", action="store_true", dest="tracebacks", default=False)
parser.add_option("-r", "--reactor", help="Which reactor to use (see --help-reactors for a list).", dest="reactor", default=DEFAULT_REACTOR)
parser.add_option("-p", "--port", help="Port to start the server on.", type="int", dest="port", default=DEFAULT_PORT)
+parser.add_option("-i", "--ip", help="IP address to listen on.", dest="ip", default="0.0.0.0")
parser.add_option("-l", "--logfile", help="Path to twisted log file.", dest="logfile")
parser.add_option("-c", "--clf", help="Path to web CLF (Combined Log Format) log file.", dest="clogfile")
+parser.add_option("-C", "--certificate", help="Path to SSL certificate.", dest="sslcertificate")
+parser.add_option("-k", "--key", help="Path to SSL key.", dest="sslkey")
+parser.add_option("-H", "--certificate-chain", help="Path to SSL certificate chain file.", dest="sslchain")
+parser.add_option("-P", "--pidfile", help="Path to store PID file", dest="pidfile")
+parser.add_option("-s", "--syslog", help="Log to syslog", action="store_true", dest="syslog", default=False)
+parser.add_option("--syslog-prefix", help="Syslog prefix", dest="syslog_prefix", default="qwebirc")
sargs = sys.argv[1:]
if "ARGS" in dir(config):
if options.reactor != DEFAULT_REACTOR:
args1+=["--reactor", options.reactor]
if options.logfile:
- args+=["--logfile", options.logfile]
+ args1+=["--logfile", options.logfile]
+if options.pidfile:
+ args1+=["--pidfile", options.pidfile]
+if options.syslog:
+ args1+=["--syslog"]
+if options.syslog and options.syslog_prefix:
+ import syslog
+ syslog.openlog(options.syslog_prefix)
-args2+=["--port", options.port]
if not options.tracebacks:
args2.append("-n")
if options.clogfile:
args2+=["--logfile", options.clogfile]
+if options.sslcertificate and options.sslkey:
+ args2+=["--certificate", options.sslcertificate, "--privkey", options.sslkey, "--https", options.port]
+ if options.sslchain:
+ args2+=["--certificate-chain", options.sslchain]
+else:
+ args2+=["--port", options.port]
+
+args2+=["--ip", options.ip]
+
run_twistd(args1, args2)