about summary refs log tree commit diff
path: root/gn_auth/__init__.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-08 04:47:02 +0300
committerFrederick Muriuki Muriithi2023-08-08 04:47:02 +0300
commitb2c23d6ddcb581a1dfd44f3a695aab15b35c9b63 (patch)
treeb7c049fb75afda32589847d8517c6218c7f29014 /gn_auth/__init__.py
parentd88ef631a78c32baed34a126d79f4679a2f09d10 (diff)
downloadgn-auth-b2c23d6ddcb581a1dfd44f3a695aab15b35c9b63.tar.gz
Fix issues caught by linter
* Add a .pylintrc to silence annoying messages
* Fix imports
* Add missing `parse_db_url` function
* Add a new `gn_auth.auth.db.redis` module
Diffstat (limited to 'gn_auth/__init__.py')
-rw-r--r--gn_auth/__init__.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gn_auth/__init__.py b/gn_auth/__init__.py
index 7d9228d..9b0264c 100644
--- a/gn_auth/__init__.py
+++ b/gn_auth/__init__.py
@@ -1,16 +1,19 @@
+"""Application initialisation module."""
+
 import os
 import sys
 import logging
+from typing import Optional
 
 from flask import Flask
 
-from . import settings
-
 from gn_auth.auth import oauth2
 from gn_auth.misc_views import misc
 
 from gn_auth.auth.authentication.oauth2.server import setup_oauth2_server
 
+from . import settings
+
 class ConfigurationError(Exception):
     """Raised in case of a configuration error."""
 
@@ -48,14 +51,14 @@ def setup_logging_handlers(app: Flask) -> None:
     root_logger.addHandler(stderr_handler)
     root_logger.setLevel(app.config["LOGLEVEL"])
 
-def create_app(config: dict = {}) -> Flask:
+def create_app(config: Optional[dict] = None) -> Flask:
     """Create and return a new flask application."""
     app = Flask(__name__)
 
     # ====== Setup configuration ======
     app.config.from_object(settings) # Default settings
     # Override defaults with startup settings
-    app.config.update(config)
+    app.config.update(config or {})
     # Override app settings with site-local settings
     if "GN_AUTH_CONF" in os.environ:
         app.config.from_envvar("GN_AUTH_CONF")