mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 03:24:18 +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")
|
||||
|
||||
app = create_app()
|
||||
|
||||
# main()
|
||||
main()
|
||||
|
||||
13
mint/app.py
13
mint/app.py
@@ -1,19 +1,14 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
from typing import Union
|
||||
|
||||
|
||||
from fastapi import FastAPI
|
||||
from loguru import logger
|
||||
from secp256k1 import PublicKey
|
||||
|
||||
import core.settings as settings
|
||||
from core.settings import (
|
||||
CASHU_DIR,
|
||||
)
|
||||
from core.settings import CASHU_DIR, DEBUG
|
||||
|
||||
from lightning import WALLET
|
||||
from mint.ledger import Ledger
|
||||
from mint.migrations import m001_initial
|
||||
|
||||
from . import ledger
|
||||
@@ -43,7 +38,7 @@ def create_app(config_object="core.settings") -> FastAPI:
|
||||
def __init__(self):
|
||||
self.padding = 0
|
||||
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"
|
||||
else:
|
||||
self.fmt: str = self.minimal_fmt
|
||||
@@ -87,3 +82,5 @@ def create_app(config_object="core.settings") -> FastAPI:
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# main()
|
||||
|
||||
app = create_app()
|
||||
|
||||
@@ -41,7 +41,7 @@ def main(
|
||||
d[a.strip("--")] = True # argument like --key
|
||||
|
||||
config = uvicorn.Config(
|
||||
"mint.__main__:app",
|
||||
"mint.app:app",
|
||||
port=port,
|
||||
host=host,
|
||||
ssl_keyfile=ssl_keyfile,
|
||||
|
||||
Reference in New Issue
Block a user