Skip to content

Commit

Permalink
Properly close secret key file
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasbrunner committed Oct 3, 2023
1 parent b6a3798 commit 3380e8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion strongMan/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def create_read_key(file_path):
'''
SECRET_FILE = file_path
try:
return open(SECRET_FILE).read().strip()
with open(SECRET_FILE) as f:
return f.read().strip()
except IOError:
try:
import random
Expand Down

0 comments on commit 3380e8f

Please sign in to comment.