mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-26 11:30:23 +00:00
Provide for configuration file specification of http listen
Establish a config file for certain configuration parameters that control service startup and things that are best managed via out of band configuration file and easiest to do with a restart. For now, implement control of http service binding. From Lucio Seki
This commit is contained in:
parent
2d9df67272
commit
97c928350c
@ -507,7 +507,7 @@ def _assemble_json(responses, resource, url, extension):
|
||||
rspdata, sort_keys=True, indent=4, ensure_ascii=False).encode('utf-8')
|
||||
|
||||
|
||||
def serve():
|
||||
def serve(bind_host, bind_port):
|
||||
# TODO(jbjohnso): move to unix socket and explore
|
||||
# either making apache deal with it
|
||||
# or just supporting nginx or lighthttpd
|
||||
@ -519,20 +519,22 @@ def serve():
|
||||
#also, the potential for direct http can be handy
|
||||
#todo remains unix domain socket for even http
|
||||
eventlet.wsgi.server(
|
||||
eventlet.listen(('::', 4005, 0, 0), family=socket.AF_INET6),
|
||||
eventlet.listen((bind_host, bind_port, 0, 0), family=socket.AF_INET6),
|
||||
resourcehandler, log=False, log_output=False, debug=False)
|
||||
|
||||
|
||||
class HttpApi(object):
|
||||
def __init__(self):
|
||||
def __init__(self, bind_host=None, bind_port=None):
|
||||
self.server = None
|
||||
self.bind_host = bind_host or '::'
|
||||
self.bind_port = bind_port or 4005
|
||||
|
||||
def start(self):
|
||||
global auditlog
|
||||
global tracelog
|
||||
tracelog = log.Logger('trace')
|
||||
auditlog = log.Logger('audit')
|
||||
self.server = eventlet.spawn(serve)
|
||||
self.server = eventlet.spawn(serve, self.bind_host, self.bind_port)
|
||||
|
||||
|
||||
_cleaner = eventlet.spawn(_sessioncleaner)
|
||||
|
@ -39,6 +39,7 @@ import fcntl
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
import ConfigParser
|
||||
|
||||
|
||||
def _daemonize():
|
||||
@ -115,6 +116,7 @@ def doexit():
|
||||
|
||||
|
||||
def run():
|
||||
configfile = "/etc/confluent/service.cfg"
|
||||
_checkpidfile()
|
||||
confluentcore.load_plugins()
|
||||
_daemonize()
|
||||
@ -127,8 +129,16 @@ def run():
|
||||
#dbgsock = eventlet.listen("/var/run/confluent/dbg.sock",
|
||||
# family=socket.AF_UNIX)
|
||||
#eventlet.spawn_n(backdoor.backdoor_server, dbgsock)
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read(configfile)
|
||||
try:
|
||||
bind_host = config.get('http', 'bindhost')
|
||||
bind_port = config.getint('http', 'bindport')
|
||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
|
||||
bind_host = None
|
||||
bind_port = None
|
||||
consoleserver.start_console_sessions()
|
||||
webservice = httpapi.HttpApi()
|
||||
webservice = httpapi.HttpApi(bind_host, bind_port)
|
||||
webservice.start()
|
||||
sockservice = sockapi.SockApi()
|
||||
sockservice.start()
|
||||
|
Loading…
Reference in New Issue
Block a user