Skip to content

Commit

Permalink
Merge pull request #540 from phenobarbital/test-version
Browse files Browse the repository at this point in the history
contrib for adding navconfig into an aiohttp application
  • Loading branch information
phenobarbital authored Nov 11, 2024
2 parents 7bebdf9 + 232878d commit cfc6db9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions navconfig/contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import annotations

from .web import AiohttpConfig
12 changes: 12 additions & 0 deletions navconfig/contrib/web.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from aiohttp import web
from navconfig import config, Kardex

class AiohttpConfig:
def __init__(self, app: web.Application, key_name: str = 'config'):
self.app = app
config_key = web.AppKey(key_name, Kardex)
if hasattr(self.app, key_name):
# already configured
return
self.app[config_key] = config
setattr(self.app, key_name, config)
2 changes: 1 addition & 1 deletion navconfig/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Configuration tool for all Navigator Services "
"Tool for accessing Config info from different sources."
)
__version__ = "1.7.10"
__version__ = "1.7.11"
__author__ = "Jesus Lara"
__author_email__ = "[email protected]"
__license__ = "MIT"

0 comments on commit cfc6db9

Please sign in to comment.