Skip to content

[Request] Allow the session file path to be defined #221

Description

@ogarcia

You would simply apply this change:

diff --git a/src/constants.py b/src/constants.py
  index c43f24f..5ef9c60 100644
  --- a/src/constants.py
  +++ b/src/constants.py
  @@ -264,7 +264,9 @@ CONST = {
                         SETTINGS["CAPTCHABOT_TIME_VIDEO_GEN_INTERVAL_S"])),

       # Last session restorable RAM data backup file path
  -    "F_SESSION": SCRIPT_PATH + "/session.pkl",
  +    "F_SESSION":
  +        os_getenv("CAPTCHABOT_F_SESSION",
  +                  SCRIPT_PATH + "/session.pkl"),

       # Languages texts files directory path
       "LANG_DIR": SCRIPT_PATH + "/language",

This is the only thing preventing the bot from starting when the source code directory is read-only.

Another improvement I would suggest is that you simply be able to specify, using a single variable, where you want everything the bot needs to be written (a definition of the root directory for that purpose). Right now, that's pretty much hardcoded, and you have to do it all with different variables:

Environment=CAPTCHABOT_CHATS_DIR=%S/captchabot/chats
Environment=CAPTCHABOT_CAPTCHAS_DIR=%S/captchabot/captchas
Environment=CAPTCHABOT_F_ALLOWED_USERS=%S/captchabot/allowedusers.txt
Environment=CAPTCHABOT_F_ALLOWED_GROUPS=%S/captchabot/allowedgroups.txt
Environment=CAPTCHABOT_F_BAN_GROUPS=%S/captchabot/bannedgroups.txt
Environment=CAPTCHABOT_F_SESSION=%S/captchabot/session.pkl

When it could be something like:

Environment=CAPTCHABOT_RW_DIR=%S/captchabot

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions