Added property to ExtApp for easy access to settings

master
androiddrew 6 years ago
parent 46671d09fb
commit ae2f1c696c

@ -1,6 +1,6 @@
import os
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.openapi import Metadata, OpenAPIHandler, OpenAPIUIHandler
from molten.settings import SettingsComponent
@ -53,6 +53,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):
"""

Loading…
Cancel
Save