Skip to content

Commit

Permalink
Fix bandit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriae committed Dec 19, 2024
1 parent 34b43be commit 1ce4c6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ SECRET_KEY=your_secret_key
MONGO_URI=mongodb://localhost:27017/scouting_app
TBA_AUTH_KEY=your_tba_api_key
DEBUG=False
HOST=localhost
PORT=5000
```
4. Make a virtual environment: `python -m venv venv`
- To activate (type into command line):
Expand Down
9 changes: 8 additions & 1 deletion app/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@
app = create_app()

if __name__ == "__main__":
app.run(debug=True) if os.getenv("DEBUG") == "True" else serve(app, host="0.0.0.0", port=5000)
debug_mode = os.getenv("DEBUG", "False") == "True"
host = os.getenv("HOST", "127.0.0.1")
port = int(os.getenv("PORT", 5000))

if debug_mode:
app.run(debug=True, host=host, port=port)
else:
serve(app, host=host, port=port)
2 changes: 1 addition & 1 deletion app/team/team_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def ensure_connected(self):
def generate_join_code(self):
"""Generate a unique 6-character join code"""
while True:
code = ''.join(random.choices(string.ascii_uppercase + string.digits, k=6))
code = ''.join(secrets.choice(string.ascii_uppercase + string.digits) for _ in range(6))
if not self.db.teams.find_one({"team_join_code": code}):
return code

Expand Down

0 comments on commit 1ce4c6f

Please sign in to comment.