Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment optimisation #261

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

marco-emmanuel-noto
Copy link

Hi!

I've been working in the last two days on optimizing this wonderful project for deployment on Railway. I've decided to go with that PaaS because it is very intuitive, even for people that don't have a lot of knowledge about this kind of stuff. From what I've observed, my changes have not impaired the functioning of the bot in any way. But it is hard to say without a test suite, so extra caution should be paid.
I'm not a python developer, so sorry if I didn't do everything idiomatically. Please, feel free to give any pointers to improve my code.

Here is a list of my changes:

  • Changed Dockerfile to use alpine instead of slim (smaller footprint)
  • Restructured config files, moving all secrets to .env and removing .yml from .gitignore
  • Using os to get the env variables so that it will also work when served from railway
  • Added on click deeply button in the readme

Copy link

@0xYasser 0xYasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

use_chatgpt_api = config_yaml.get("use_chatgpt_api", True)
allowed_telegram_usernames = config_yaml["allowed_telegram_usernames"]
env_allowed_users = os.environ.get('ALLOWED_TELEGRAM_USERNAMES', '')
allowed_telegram_usernames = (lambda s: s.split(',') if s else [])(os.environ.get('ALLOWED_TELEGRAM_USERNAMES', ''))
new_dialog_timeout = config_yaml["new_dialog_timeout"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not have a default value. it should be

new_dialog_timeout = config_yaml.get("new_dialog_timeout", 600)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants