Implement indexing into Apache Druid #1
|
@ -12,3 +12,4 @@ conf/irc.json
|
||||||
conf/dist.sh
|
conf/dist.sh
|
||||||
conf/blacklist.json
|
conf/blacklist.json
|
||||||
env/
|
env/
|
||||||
|
.idea/
|
||||||
|
|
49
threshold
49
threshold
|
@ -19,6 +19,7 @@ from core.server import ServerFactory
|
||||||
from utils.cleanup import handler
|
from utils.cleanup import handler
|
||||||
from utils.loaders.command_loader import loadCommands
|
from utils.loaders.command_loader import loadCommands
|
||||||
from utils.logging.log import log
|
from utils.logging.log import log
|
||||||
|
from os import getenv
|
||||||
|
|
||||||
Factory.noisy = False
|
Factory.noisy = False
|
||||||
|
|
||||||
|
@ -38,9 +39,25 @@ stdout = getwriter("utf8")(stdout) # this is a generic fix but we all know
|
||||||
stderr = getwriter("utf8")(stderr) # it's just for the retards on Rizon using
|
stderr = getwriter("utf8")(stderr) # it's just for the retards on Rizon using
|
||||||
# unicode quit messages for no reason
|
# unicode quit messages for no reason
|
||||||
|
|
||||||
|
# Main listener
|
||||||
|
listener_address = getenv("THRESHOLD_LISTENER_HOST") or main.config["Listener"]["Address"]
|
||||||
|
listener_port = int(getenv("THRESHOLD_LISTENER_PORT")) or main.config["Listener"]["Port"]
|
||||||
|
listener_ssl = int(getenv("THRESHOLD_LISTENER_SSL")) or main.config["Listener"]["UseSSL"]
|
||||||
|
|
||||||
|
# RelayAPI
|
||||||
|
relay_enabled = int(getenv("THRESHOLD_RELAY_ENABLED")) or main.config["Relay"]["Enabled"]
|
||||||
|
relay_address = getenv("THRESHOLD_RELAY_HOST") or main.config["RelayAPI"]["Address"]
|
||||||
|
relay_port = int(getenv("THRESHOLD_RELAY_PORT")) or main.config["RelayAPI"]["Port"]
|
||||||
|
relay_ssl = int(getenv("THRESHOLD_RELAY_SSL")) or main.config["RelayAPI"]["UseSSL"]
|
||||||
|
|
||||||
|
# Web API
|
||||||
|
api_enabled = int(getenv("THRESHOLD_API_ENABLED")) or main.config["API"]["Enabled"]
|
||||||
|
api_address = getenv("THRESHOLD_API_HOST") or main.config["API"]["Address"]
|
||||||
|
api_port = int(getenv("THRESHOLD_API_PORT")) or main.config["API"]["Port"]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
listener = ServerFactory()
|
listener = ServerFactory()
|
||||||
if main.config["Listener"]["UseSSL"] is True:
|
if listener_ssl is True:
|
||||||
reactor.listenSSL(
|
reactor.listenSSL(
|
||||||
main.config["Listener"]["Port"],
|
main.config["Listener"]["Port"],
|
||||||
listener,
|
listener,
|
||||||
|
@ -48,50 +65,50 @@ if __name__ == "__main__":
|
||||||
main.certPath + main.config["Key"],
|
main.certPath + main.config["Key"],
|
||||||
main.certPath + main.config["Certificate"],
|
main.certPath + main.config["Certificate"],
|
||||||
),
|
),
|
||||||
interface=main.config["Listener"]["Address"],
|
interface=listener_address,
|
||||||
)
|
)
|
||||||
log(
|
log(
|
||||||
"Threshold running with SSL on %s:%s"
|
"Threshold running with SSL on %s:%s"
|
||||||
% (main.config["Listener"]["Address"], main.config["Listener"]["Port"])
|
% (listener_address, listener_port)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
main.config["Listener"]["Port"],
|
listener_port,
|
||||||
listener,
|
listener,
|
||||||
interface=main.config["Listener"]["Address"],
|
interface=listener_address,
|
||||||
)
|
)
|
||||||
log("Threshold running on %s:%s" % (main.config["Listener"]["Address"], main.config["Listener"]["Port"]))
|
log("Threshold running on %s:%s" % (listener_address, listener_port))
|
||||||
if main.config["RelayAPI"]["Enabled"]:
|
if relay_enabled:
|
||||||
relay = RelayFactory()
|
relay = RelayFactory()
|
||||||
if main.config["RelayAPI"]["UseSSL"] is True:
|
if relay_ssl is True:
|
||||||
reactor.listenSSL(
|
reactor.listenSSL(
|
||||||
main.config["RelayAPI"]["Port"],
|
relay_port,
|
||||||
relay,
|
relay,
|
||||||
DefaultOpenSSLContextFactory(
|
DefaultOpenSSLContextFactory(
|
||||||
main.certPath + main.config["Key"],
|
main.certPath + main.config["Key"],
|
||||||
main.certPath + main.config["Certificate"],
|
main.certPath + main.config["Certificate"],
|
||||||
),
|
),
|
||||||
interface=main.config["RelayAPI"]["Address"],
|
interface=relay_address,
|
||||||
)
|
)
|
||||||
log(
|
log(
|
||||||
"Threshold relay running with SSL on %s:%s"
|
"Threshold relay running with SSL on %s:%s"
|
||||||
% (main.config["RelayAPI"]["Address"], main.config["RelayAPI"]["Port"])
|
% (relay_address, relay_port)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
main.config["RelayAPI"]["Port"],
|
relay_port,
|
||||||
relay,
|
relay,
|
||||||
interface=main.config["RelayAPI"]["Address"],
|
interface=relay_address,
|
||||||
)
|
)
|
||||||
log(
|
log(
|
||||||
"Threshold relay running on %s:%s"
|
"Threshold relay running on %s:%s"
|
||||||
% (main.config["RelayAPI"]["Address"], main.config["RelayAPI"]["Port"])
|
% (relay_address, relay_port)
|
||||||
)
|
)
|
||||||
for net in main.network.keys():
|
for net in main.network.keys():
|
||||||
main.network[net].start_bots()
|
main.network[net].start_bots()
|
||||||
modules.counters.setupCounterLoop()
|
modules.counters.setupCounterLoop()
|
||||||
if main.config["API"]["Enabled"]:
|
if api_enabled:
|
||||||
api = API()
|
api = API()
|
||||||
api.app.run(main.config["API"]["Address"], main.config["API"]["Port"])
|
api.app.run(api_address, api_port)
|
||||||
else:
|
else:
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
Loading…
Reference in New Issue