Add global state module
This commit is contained in:
20
base.py
20
base.py
@ -13,7 +13,7 @@ logger.setLevel(logging.DEBUG)
|
||||
app = FastAPI()
|
||||
util = importlib.import_module("util").Utilities()
|
||||
constants = importlib.import_module("constants").Constants()
|
||||
|
||||
glob_state = importlib.import_module("state").State(app, util, constants)
|
||||
|
||||
origins = [
|
||||
"https://codey.lol",
|
||||
@ -25,6 +25,9 @@ allow_credentials=True,
|
||||
allow_methods=["POST"],
|
||||
allow_headers=["*"])
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Blacklisted routes
|
||||
"""
|
||||
@ -50,16 +53,17 @@ End Blacklisted Routes
|
||||
"""
|
||||
Actionable Routes
|
||||
"""
|
||||
|
||||
randmsg_endpoint = importlib.import_module("endpoints.rand_msg").RandMsg(app, util, constants)
|
||||
counter_endpoints = importlib.import_module("endpoints.counters").Counters(app, util, constants, glob_state)
|
||||
randmsg_endpoint = importlib.import_module("endpoints.rand_msg").RandMsg(app, util, constants, glob_state)
|
||||
transcription_endpoints = importlib.import_module("endpoints.transcriptions").Transcriptions(app, util, constants, glob_state)
|
||||
# Below also provides: /lyric_cache_list/ (in addition to /lyric_search/)
|
||||
lyric_search_endpoint = importlib.import_module("endpoints.lyric_search").LyricSearch(app, util, constants)
|
||||
lyric_search_endpoint = importlib.import_module("endpoints.lyric_search").LyricSearch(app, util, constants, glob_state)
|
||||
# Below provides numerous LastFM-fed endpoints
|
||||
lastfm_endpoints = importlib.import_module("endpoints.lastfm").LastFM(app, util, constants)
|
||||
lastfm_endpoints = importlib.import_module("endpoints.lastfm").LastFM(app, util, constants, glob_state)
|
||||
# Below: YT endpoint(s)
|
||||
yt_endpoints = importlib.import_module("endpoints.yt").YT(app, util, constants)
|
||||
# Below: Transcription endpoints
|
||||
transcription_endpoints = importlib.import_module("endpoints.transcriptions").Transcriptions(app, util, constants)
|
||||
yt_endpoints = importlib.import_module("endpoints.yt").YT(app, util, constants, glob_state)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
Reference in New Issue
Block a user