コード例 #1
0
def configure(app, configuration):
    app.config["redis.host"] = env("RedisHost") or "localhost"
    app.config["redis.port"] = env("RedisPort") or 6379
    app.config["redis.password"] = env("RedisPassword")

    # Add dependency to provider
    service = RedisService(app.config).get_database()
    provider.register("RedisService", service)
コード例 #2
0
def configure(app, configuration):
    app.config["mongo.host"] = env("Mongo_Host") or configuration["mongo.host"]
    app.config["mongo.db"] = env("Mongo_Db") or configuration["mongo.db"]
    app.config["mongo.username"] = env("Mongo_Username")
    app.config["mongo.password"] = env("Mongo_Password")

    # Add dependency to provider
    service = MongoService(app.config).get_database()
    provider.register("MongoService", service)