Skip to content

Update configs.py #8

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions configs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
class Config:
API_ID = int(os.environ.get('API_ID', 0))
API_HASH = str(os.environ.get('API_HASH', None))
BOT_TOKEN = str(os.environ.get('BOT_TOKEN', None))
MONGO_URI = str(os.environ.get('MONGO_URI', None))
UPDATES_CHANNEL = str(os.environ.get('UPDATES_CHANNEL', None)) #Start Without @
API_ID = int(os.environ.get('API_ID', 6435225))
API_HASH = str(os.environ.get('API_HASH', 4e984ea35f854762dcde906dce426c2d))
Copy link

Choose a reason for hiding this comment

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

Correct the syntax error in the API_HASH assignment.

- API_HASH = str(os.environ.get('API_HASH', 4e984ea35f854762dcde906dce426c2d))
+ API_HASH = str(os.environ.get('API_HASH', '4e984ea35f854762dcde906dce426c2d'))

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
API_HASH = str(os.environ.get('API_HASH', 4e984ea35f854762dcde906dce426c2d))
API_HASH = str(os.environ.get('API_HASH', '4e984ea35f854762dcde906dce426c2d'))

BOT_TOKEN = str(os.environ.get('BOT_TOKEN', 6571094339:AAGcENp3AmPPJslc88ERGsT_VdJ20hKTtvQ))
Copy link

Choose a reason for hiding this comment

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

Correct the syntax error in the BOT_TOKEN assignment.

- BOT_TOKEN = str(os.environ.get('BOT_TOKEN', 6571094339:AAGcENp3AmPPJslc88ERGsT_VdJ20hKTtvQ))
+ BOT_TOKEN = str(os.environ.get('BOT_TOKEN', '6571094339:AAGcENp3AmPPJslc88ERGsT_VdJ20hKTtvQ'))

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
BOT_TOKEN = str(os.environ.get('BOT_TOKEN', 6571094339:AAGcENp3AmPPJslc88ERGsT_VdJ20hKTtvQ))
BOT_TOKEN = str(os.environ.get('BOT_TOKEN', '6571094339:AAGcENp3AmPPJslc88ERGsT_VdJ20hKTtvQ'))

MONGO_URI = str(os.environ.get('MONGO_URI', mongodb+srv://Mrdaxx123:[email protected]/?retryWrites=true&w=majority))
Copy link

Choose a reason for hiding this comment

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

Correct the syntax error in the MONGO_URI assignment and consider the security implications of hardcoding credentials.

- MONGO_URI = str(os.environ.get('MONGO_URI', mongodb+srv://Mrdaxx123:[email protected]/?retryWrites=true&w=majority))
+ MONGO_URI = str(os.environ.get('MONGO_URI', 'mongodb+srv://Mrdaxx123:[email protected]/?retryWrites=true&w=majority'))

Consider using environment variables or secure vault solutions to manage sensitive information such as database credentials.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
MONGO_URI = str(os.environ.get('MONGO_URI', mongodb+srv://Mrdaxx123:Mrdaxx123@cluster0.q1da65h.mongodb.net/?retryWrites=true&w=majority))
MONGO_URI = str(os.environ.get('MONGO_URI', 'mongodb+srv://Mrdaxx123:[email protected]/?retryWrites=true&w=majority'))

UPDATES_CHANNEL = str(os.environ.get('UPDATES_CHANNEL', Matching_pfp_Gallery)) #Start Without @
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The examination of the UPDATES_CHANNEL usage in the codebase, particularly in Flux/forcesub.py, indicates that it is used in contexts where a Telegram channel identifier is expected. Specifically, it is used to form a URL (https://t.me/{Config.UPDATES_CHANNEL}) which typically requires the channel name to start with '@'.

However, the default value set in configs.py does not include an '@', and it's unclear if the environment variable typically includes this character. This could lead to inconsistencies depending on how the environment variable is set up.

To ensure consistent behavior, it would be advisable to either:

  • Ensure that the environment variable always includes the '@' when set, or
  • Modify the code to automatically prepend '@' if it's missing.

Action Points:

  • Review the environment setup to confirm how UPDATES_CHANNEL is typically configured.
  • Consider updating the code to handle cases where the '@' might be missing from the environment variable.
Analysis chain

Ensure the UPDATES_CHANNEL value starts with '@' if required by the application's logic.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if the UPDATES_CHANNEL should start with '@'.

# Test: Search for usage of UPDATES_CHANNEL to check if it's prefixed with '@' in other parts of the code.
rg --type py 'UPDATES_CHANNEL'

Length of output: 398