Added property to ExtApp for easy access to settings

master
androiddrew 6 years ago
parent 46671d09fb
commit 5ff91dc91b

@ -1,6 +1,5 @@
import os
from typing import Tuple from typing import Tuple
from molten import App, Route, ResponseRendererMiddleware from molten import App, Route, ResponseRendererMiddleware, Settings
from molten.http import HTTP_404, Request from molten.http import HTTP_404, Request
from molten.openapi import Metadata, OpenAPIHandler, OpenAPIUIHandler from molten.openapi import Metadata, OpenAPIHandler, OpenAPIUIHandler
from molten.settings import SettingsComponent from molten.settings import SettingsComponent
@ -53,6 +52,14 @@ class ExtApp(App):
), ),
) )
@property
def settings(self):
def _get_settings(_settings: Settings):
return _settings
settings = self.injector.get_resolver().resolve(_get_settings)()
return settings
def create_app(_components=None, _middleware=None, _routes=None, _renderers=None): def create_app(_components=None, _middleware=None, _routes=None, _renderers=None):
""" """

Loading…
Cancel
Save