mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
refactor(chart): Added docstring in each file and function. Fixed long lines
This commit is contained in:
parent
c5d3d9fe9b
commit
ed8cf91558
7 changed files with 190 additions and 30 deletions
|
@ -1,16 +1,22 @@
|
|||
"""
|
||||
This is the main application file for the chart service using FastAPI.
|
||||
|
||||
The application serves static files, provides endpoints for generating charts,
|
||||
and integrates with Plausible Analytics for tracking usage.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import uvicorn
|
||||
import yaml
|
||||
|
||||
from fastapi import FastAPI
|
||||
from starlette.staticfiles import StaticFiles
|
||||
|
||||
from chart.middleware.plausible_analytics import PlausibleAnalytics
|
||||
from chart.routes import get_chart, get_chart_period
|
||||
from chart.utils.load_config import load_config
|
||||
|
||||
app = FastAPI()
|
||||
config = yaml.safe_load(open('config.yaml'))
|
||||
config = load_config('config.yaml')
|
||||
|
||||
if not os.path.exists('../charts'):
|
||||
os.mkdir('../charts')
|
||||
|
@ -23,11 +29,16 @@ app.include_router(get_chart_period.router)
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
uvicorn.run(
|
||||
app,
|
||||
host=config['server']['host'],
|
||||
port=3030,
|
||||
ssl_keyfile=config['server']['ssl']['private_key'] if config['server']['ssl']['work'] else None,
|
||||
ssl_certfile=config['server']['ssl']['cert'] if config['server']['ssl']['work'] else None
|
||||
ssl_keyfile=
|
||||
config['server']['ssl']['private_key']
|
||||
if config['server']['ssl']['work']
|
||||
else None,
|
||||
ssl_certfile=
|
||||
config['server']['ssl']['cert']
|
||||
if config['server']['ssl']['work']
|
||||
else None
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue