mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 15:26:46 -06:00
37 lines
806 B
Python
37 lines
806 B
Python
##########################################################################
|
|
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
##########################################################################
|
|
|
|
from flask import current_app
|
|
|
|
from .registry import DriverRegistry
|
|
|
|
|
|
def get_driver(_type, app=None):
|
|
|
|
if app is not None:
|
|
DriverRegistry.load_modules(app)
|
|
|
|
return DriverRegistry.get(_type)
|
|
|
|
|
|
def init_app(app):
|
|
drivers = dict()
|
|
|
|
setattr(app, '_pgadmin_server_drivers', drivers)
|
|
DriverRegistry.load_modules(app)
|
|
|
|
return drivers
|
|
|
|
|
|
def ping():
|
|
drivers = getattr(current_app, '_pgadmin_server_drivers', None)
|
|
|
|
for type in drivers:
|
|
drivers[type].gc_timeout()
|