from twisted.internet import protocol
from fixbot import config
from fixbot.api import amp
class ServerOptions (config.ConfigOptions) :
"""
Options for the API component of the Nexus
"""
optParameters = [
( "api-listen", "l", "127.0.0.1", "address for API server to listen on" ),
( "api-port", "P", 34888, "port for API server to listen on", int ),
( "api-secret", None, None, "secret key for API connections" ),
]
class ClientOptions (config.ConfigOptions) :
"""
Options for the API component of a Module
"""
optParameters = [
( "api-server", "s", "127.0.0.1", "address of API server to connect to" ),
( "api-port", "P", 34888, "port of API server to connect to", int ),
]
class ServerFactory (protocol.ServerFactory) :
def __init__ (self, nexus, config) :
self.nexus = nexus
# protocol to use
self.protocol = amp.ServerProtocol
# XXX: only used for legacy
self.secret = config.get('api-secret')