mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 11:24:19 +01:00
refactor mint
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
from .app import create_app, main
|
from .main import main
|
||||||
|
|
||||||
print("main")
|
print("main")
|
||||||
|
|
||||||
app = create_app()
|
|
||||||
|
|
||||||
# main()
|
main()
|
||||||
|
|||||||
13
mint/app.py
13
mint/app.py
@@ -1,19 +1,14 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from secp256k1 import PublicKey
|
|
||||||
|
|
||||||
import core.settings as settings
|
from core.settings import CASHU_DIR, DEBUG
|
||||||
from core.settings import (
|
|
||||||
CASHU_DIR,
|
|
||||||
)
|
|
||||||
from lightning import WALLET
|
from lightning import WALLET
|
||||||
from mint.ledger import Ledger
|
|
||||||
from mint.migrations import m001_initial
|
from mint.migrations import m001_initial
|
||||||
|
|
||||||
from . import ledger
|
from . import ledger
|
||||||
@@ -43,7 +38,7 @@ def create_app(config_object="core.settings") -> FastAPI:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.padding = 0
|
self.padding = 0
|
||||||
self.minimal_fmt: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SS}</green> | <level>{level}</level> | <level>{message}</level>\n"
|
self.minimal_fmt: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SS}</green> | <level>{level}</level> | <level>{message}</level>\n"
|
||||||
if settings.DEBUG:
|
if DEBUG:
|
||||||
self.fmt: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SS}</green> | <level>{level: <4}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | <level>{message}</level>\n"
|
self.fmt: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SS}</green> | <level>{level: <4}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | <level>{message}</level>\n"
|
||||||
else:
|
else:
|
||||||
self.fmt: str = self.minimal_fmt
|
self.fmt: str = self.minimal_fmt
|
||||||
@@ -87,3 +82,5 @@ def create_app(config_object="core.settings") -> FastAPI:
|
|||||||
|
|
||||||
# if __name__ == "__main__":
|
# if __name__ == "__main__":
|
||||||
# main()
|
# main()
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def main(
|
|||||||
d[a.strip("--")] = True # argument like --key
|
d[a.strip("--")] = True # argument like --key
|
||||||
|
|
||||||
config = uvicorn.Config(
|
config = uvicorn.Config(
|
||||||
"mint.__main__:app",
|
"mint.app:app",
|
||||||
port=port,
|
port=port,
|
||||||
host=host,
|
host=host,
|
||||||
ssl_keyfile=ssl_keyfile,
|
ssl_keyfile=ssl_keyfile,
|
||||||
|
|||||||
Reference in New Issue
Block a user