コード例 #1
0
    except Exception, e:
        logging.error("Exception loading counterwallet config: %s" % e)
    
    #xnova(7/16/2014): Disable for now, as this uses requests under the surface, which may not be safe for a gevent-based app
    #rollbar integration
    #if config.ROLLBAR_TOKEN:
    #    logging.info("Rollbar support enabled. Logging for environment: %s" % config.ROLLBAR_ENV)
    #    rollbar.init(config.ROLLBAR_TOKEN, config.ROLLBAR_ENV, allow_logging_basic_config=False)
    #    
    #    def report_errors(ex_cls, ex, tb):
    #        rollbar.report_exc_info((ex_cls, ex, tb))
    #        raise ex #re-raise
    #    sys.excepthook = report_errors

    # GeoIP
    config.GEOIP = util.init_geoip()

    #Connect to mongodb
    logging.info("Connecting to mongoDB backend ...")
    mongo_client = pymongo.MongoClient(config.MONGODB_CONNECT, config.MONGODB_PORT)
    mongo_db = mongo_client[config.MONGODB_DATABASE] #will create if it doesn't exist
    if config.MONGODB_USER and config.MONGODB_PASSWORD:
        if not mongo_db.authenticate(config.MONGODB_USER, config.MONGODB_PASSWORD):
            raise Exception("Could not authenticate to mongodb with the supplied username and password.")
    config.mongo_db = mongo_db #should be able to access fine across greenlets, etc

    #insert mongo indexes if need-be (i.e. for newly created database)
    ##COLLECTIONS THAT ARE PURGED AS A RESULT OF A REPARSE
    #processed_blocks
    mongo_db.processed_blocks.ensure_index('block_index', unique=True)
    #tracked_assets
コード例 #2
0
ファイル: csfrblockd.py プロジェクト: saffroncoin/csfrblockd
    except Exception, e:
        logging.error("Exception loading csfrwallet config: %s" % e)
    
    #xnova(7/16/2014): Disable for now, as this uses requests under the surface, which may not be safe for a gevent-based app
    #rollbar integration
    #if config.ROLLBAR_TOKEN:
    #    logging.info("Rollbar support enabled. Logging for environment: %s" % config.ROLLBAR_ENV)
    #    rollbar.init(config.ROLLBAR_TOKEN, config.ROLLBAR_ENV, allow_logging_basic_config=False)
    #    
    #    def report_errors(ex_cls, ex, tb):
    #        rollbar.report_exc_info((ex_cls, ex, tb))
    #        raise ex #re-raise
    #    sys.excepthook = report_errors

    # GeoIP
    config.GEOIP = util.init_geoip()

    #Connect to mongodb
    logging.info("Connecting to mongoDB backend ...")
    mongo_client = pymongo.MongoClient(config.MONGODB_CONNECT, config.MONGODB_PORT)
    mongo_db = mongo_client[config.MONGODB_DATABASE] #will create if it doesn't exist
    if config.MONGODB_USER and config.MONGODB_PASSWORD:
        if not mongo_db.authenticate(config.MONGODB_USER, config.MONGODB_PASSWORD):
            raise Exception("Could not authenticate to mongodb with the supplied username and password.")
    config.mongo_db = mongo_db #should be able to access fine across greenlets, etc

    #insert mongo indexes if need-be (i.e. for newly created database)
    ##COLLECTIONS THAT ARE PURGED AS A RESULT OF A REPARSE
    #processed_blocks
    mongo_db.processed_blocks.ensure_index('block_index', unique=True)
    #tracked_assets