コード例 #1
0
def main():
    log.startLogging(stdout)
    from_address = config.get("alerts", "from")
    to_address = config.get("alerts", "to")
    subject_prefix = config.get("alerts", "subject")
    alerts = Alerts(from_address, to_address, subject_prefix)
    alerts.start()

    alerts_export = AlertsExport(alerts)
    pull_share_async(alerts_export, config.get("alerts", "export"))
    reactor.run()
コード例 #2
0
ファイル: test_zmq_util.py プロジェクト: ysobolev/sputnik
 def setUp(self):
     port = random.randint(50000, 60000)
     self.push_proxy = zmq_util.push_proxy_async("tcp://127.0.0.1:%d" %
                                                 port)
     self.export = TestExport()
     self.pull_share = zmq_util.pull_share_async(
         self.export, "tcp://127.0.0.1:%d" % port)
コード例 #3
0
ファイル: engine.py プロジェクト: ysobolev/sputnik
 def init(self):
     self.share = pull_share_async(self,
                                   config.get("webserver", "engine_export"))
コード例 #4
0
ファイル: test_zmq_util.py プロジェクト: ysobolev/sputnik
 def setUp(self):
     port = random.randint(50000, 60000)
     self.push_proxy = zmq_util.push_proxy_async("tcp://127.0.0.1:%d" % port)
     self.export = TestExport()
     self.pull_share = zmq_util.pull_share_async(self.export, "tcp://127.0.0.1:%d" % port)
コード例 #5
0
ファイル: cashier.py プロジェクト: ysobolev/sputnik
def main():
    log.startLogging(sys.stdout)

    accountant = AccountantProxy("dealer",
            config.get("accountant", "cashier_export"),
            config.getint("accountant", "cashier_export_base_port"))

    session = db.make_session()
    bitcoin_conf = config.get("cashier", "bitcoin_conf")

    log.msg('connecting to bitcoin client')

    bitcoinrpc = {'BTC': BitcoinRpc(bitcoin_conf, 1)}
    compropago = Compropago(config.get("cashier", "compropago_key"))
    cold_wallet_period = config.getint("cashier", "cold_wallet_period")
    sendmail=Sendmail(config.get("administrator", "email"))
    minimum_confirmations = config.getint("cashier", "minimum_confirmations")
    alerts_proxy = AlertsProxy(config.get("alerts", "export"))
    bitgo_config = {'use_production': not config.getboolean("cashier", "testnet"),
                    'client_id': config.get("bitgo", "client_id"),
                    'client_secret': config.get("bitgo", "client_secret")}
    bitgo = BitGo(**bitgo_config)
    bitgo_private_key_file = config.get("cashier", "bitgo_private_key_file")

    cashier = Cashier(session, accountant, bitcoinrpc, compropago,
                      cold_wallet_period=cold_wallet_period,
                      sendmail=sendmail,
                      minimum_confirmations=minimum_confirmations,
                      alerts=alerts_proxy,
                      bitgo=bitgo,
                      bitgo_private_key_file=bitgo_private_key_file,
                      testnet=config.getboolean("cashier", "testnet"),
    )

    administrator_export = AdministratorExport(cashier)
    accountant_export = AccountantExport(cashier)
    webserver_export = WebserverExport(cashier)

    watchdog(config.get("watchdog", "cashier"))
    router_share_async(administrator_export,
                     config.get("cashier", "administrator_export"))
    pull_share_async(accountant_export,
                    config.get("cashier", "accountant_export"))
    router_share_async(webserver_export,
                       config.get("cashier", "webserver_export"))

    public_server = Resource()
    public_server.putChild('compropago', CompropagoHook(cashier))
    private_server = Resource()
    private_server.putChild('bitcoin', BitcoinNotify(cashier))


    if config.getboolean("webserver", "ssl"):
        key = config.get("webserver", "ssl_key")
        cert = config.get("webserver", "ssl_cert")
        cert_chain = config.get("webserver", "ssl_cert_chain")
        contextFactory = ssl.ChainedOpenSSLContextFactory(key, cert_chain)

        reactor.listenSSL(config.getint("cashier", "public_port"),
                      Site(public_server), contextFactory,
                      interface=config.get("cashier", "public_interface"))
    else:
        reactor.listenTCP(config.getint("cashier", "public_port"),
                      Site(public_server),
                      interface=config.get("cashier", "public_interface"))

    reactor.listenTCP(config.getint("cashier", "private_port"), Site(private_server),
                      interface=config.get("cashier", "private_interface"))

    reactor.run()
コード例 #6
0
ファイル: cashier.py プロジェクト: ysobolev/sputnik
def main():
    log.startLogging(sys.stdout)

    accountant = AccountantProxy(
        "dealer", config.get("accountant", "cashier_export"),
        config.getint("accountant", "cashier_export_base_port"))

    session = db.make_session()
    bitcoin_conf = config.get("cashier", "bitcoin_conf")

    log.msg('connecting to bitcoin client')

    bitcoinrpc = {'BTC': BitcoinRpc(bitcoin_conf, 1)}
    compropago = Compropago(config.get("cashier", "compropago_key"))
    cold_wallet_period = config.getint("cashier", "cold_wallet_period")
    sendmail = Sendmail(config.get("administrator", "email"))
    minimum_confirmations = config.getint("cashier", "minimum_confirmations")
    alerts_proxy = AlertsProxy(config.get("alerts", "export"))
    bitgo_config = {
        'use_production': not config.getboolean("cashier", "testnet"),
        'client_id': config.get("bitgo", "client_id"),
        'client_secret': config.get("bitgo", "client_secret")
    }
    bitgo = BitGo(**bitgo_config)
    bitgo_private_key_file = config.get("cashier", "bitgo_private_key_file")

    cashier = Cashier(
        session,
        accountant,
        bitcoinrpc,
        compropago,
        cold_wallet_period=cold_wallet_period,
        sendmail=sendmail,
        minimum_confirmations=minimum_confirmations,
        alerts=alerts_proxy,
        bitgo=bitgo,
        bitgo_private_key_file=bitgo_private_key_file,
        testnet=config.getboolean("cashier", "testnet"),
    )

    administrator_export = AdministratorExport(cashier)
    accountant_export = AccountantExport(cashier)
    webserver_export = WebserverExport(cashier)

    watchdog(config.get("watchdog", "cashier"))
    router_share_async(administrator_export,
                       config.get("cashier", "administrator_export"))
    pull_share_async(accountant_export,
                     config.get("cashier", "accountant_export"))
    router_share_async(webserver_export,
                       config.get("cashier", "webserver_export"))

    public_server = Resource()
    public_server.putChild('compropago', CompropagoHook(cashier))
    private_server = Resource()
    private_server.putChild('bitcoin', BitcoinNotify(cashier))

    if config.getboolean("webserver", "ssl"):
        key = config.get("webserver", "ssl_key")
        cert = config.get("webserver", "ssl_cert")
        cert_chain = config.get("webserver", "ssl_cert_chain")
        contextFactory = ssl.ChainedOpenSSLContextFactory(key, cert_chain)

        reactor.listenSSL(config.getint("cashier", "public_port"),
                          Site(public_server),
                          contextFactory,
                          interface=config.get("cashier", "public_interface"))
    else:
        reactor.listenTCP(config.getint("cashier", "public_port"),
                          Site(public_server),
                          interface=config.get("cashier", "public_interface"))

    reactor.listenTCP(config.getint("cashier", "private_port"),
                      Site(private_server),
                      interface=config.get("cashier", "private_interface"))

    reactor.run()
コード例 #7
0
ファイル: engine.py プロジェクト: ysobolev/sputnik
 def init(self):
     self.share = pull_share_async(self,
             config.get("webserver", "engine_export"))
コード例 #8
0
 def init(self):
     self.share = pull_share_async(self,
             config.get("webserver", "accountant_export"))