Skip to content

Commit aba7cbb

Browse files
wwwjfyfantix
authored andcommitted
refs python-gino/gino#387, add ssl parameters for all extensions
1 parent 6bc5385 commit aba7cbb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

gino/ext/sanic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ async def before_server_start(_, loop):
111111
echo=app.config.setdefault('DB_ECHO', False),
112112
min_size=app.config.setdefault('DB_POOL_MIN_SIZE', 5),
113113
max_size=app.config.setdefault('DB_POOL_MAX_SIZE', 10),
114+
ssl=app.config.setdefault('DB_SSL'),
114115
loop=loop,
115116
)
116117

tests/test_sanic.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ async def app():
7676
})
7777

7878

79+
@pytest.fixture
80+
@async_generator
81+
async def app_ssl(ssl_ctx):
82+
await _app({
83+
'DB_HOST': DB_ARGS['host'],
84+
'DB_PORT': DB_ARGS['port'],
85+
'DB_USER': DB_ARGS['user'],
86+
'DB_PASSWORD': DB_ARGS['password'],
87+
'DB_DATABASE': DB_ARGS['database'],
88+
'DB_SSL': ssl_ctx,
89+
})
90+
91+
7992
@pytest.fixture
8093
@async_generator
8194
async def app_dsn():
@@ -116,5 +129,9 @@ def test(app):
116129
_test(app)
117130

118131

132+
def test_ssl(app_ssl):
133+
_test(app_ssl)
134+
135+
119136
def test_dsn(app_dsn):
120137
_test(app_dsn)

0 commit comments

Comments
 (0)