Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsmh committed Dec 30, 2024
1 parent bf63830 commit 6fc0be8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Deploy to Fly
on:
workflow_run:
workflows: [Create and publish a Docker image]
types: [completed]
workflow_dispatch:
# workflow_run:
# workflows: [Create and publish a Docker image]
# types: [completed]

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ COPY . .
RUN poetry install --only main
ENV PORT=9000 \
TOKEN=""
ENTRYPOINT ["poetry", "run", "python", "-m", "biliparser"]
ENTRYPOINT ["poetry", "run", "biliparser"]
8 changes: 6 additions & 2 deletions biliparser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def add_handler(application: Application):
application.add_error_handler(error_handler)


if __name__ == "__main__":
def main():
if os.environ.get("TOKEN"):
TOKEN = os.environ["TOKEN"]
elif len(sys.argv) >= 2:
Expand Down Expand Up @@ -726,11 +726,15 @@ def add_handler(application: Application):
add_handler(application)
if os.environ.get("DOMAIN"):
application.run_webhook(
listen="0.0.0.0",
listen=os.environ.get("HOST", "0.0.0.0"),
port=int(os.environ.get("PORT", 9000)),
url_path=TOKEN,
webhook_url=f'{os.environ.get("DOMAIN")}{TOKEN}',
max_connections=100,
)
else:
application.run_polling()


if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ tortoise-orm = {extras = ["accel"], version = "^0.21.7"}
pytest = "^8.3.3"
pytest-asyncio = "^0.23.8"

[tool.poetry.scripts]
bilifeedbot = "biliparser.__main__:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 6fc0be8

Please sign in to comment.