Conditionally inject CLI arguments into factory (#2402)
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
from sanic import Sanic
|
||||
|
||||
|
||||
def run():
|
||||
app = Sanic("FactoryTest")
|
||||
return app
|
||||
@@ -34,3 +34,12 @@ async def shutdown(app: Sanic, _):
|
||||
|
||||
def create_app():
|
||||
return app
|
||||
|
||||
|
||||
def create_app_with_args(args):
|
||||
try:
|
||||
print(f"foo={args.foo}")
|
||||
except AttributeError:
|
||||
print(f"module={args.module}")
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user