-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Healthcheck
- Loading branch information
Showing
4 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import asyncio | ||
import sys | ||
import os | ||
import logging | ||
|
||
from bookshelfAPI import bookshelf_user_login | ||
from dotenv import load_dotenv | ||
|
||
# Used only for DOCKER HEALTHCHECK, do not import into MAIN or ANY EXTENSION | ||
load_dotenv() | ||
|
||
logger = logging.getLogger("bot") | ||
|
||
|
||
async def main(): | ||
if __name__ == "__main__": | ||
try: | ||
user_token = os.getenv('bookshelfToken') | ||
result = bookshelf_user_login(token=user_token) | ||
if result: | ||
print('HEALTHCHECK SUCCEEDED!', file=None) | ||
sys.exit(0) | ||
else: | ||
print('HEALTHCHECK FAILED!', file=None) | ||
sys.exit(1) | ||
|
||
except Exception as e: | ||
print('HEALTHCHECK FAILED!', e, file=None) | ||
sys.exit(1) | ||
|
||
|
||
logger.debug('RUNNING HEALTHCHECK') | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters