add gitignore and fix a small bug with settings if the file doesn't exist

This commit is contained in:
UpstreamData
2022-06-14 09:42:12 -06:00
parent 7c3af3da41
commit f18d37a19e
2 changed files with 10 additions and 2 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
venv/
build/
__pycache__/
pyvenv.cfg
.env/
bin/
lib/

View File

@@ -14,16 +14,17 @@ WHATSMINER_PWD = "admin"
DEBUG = False DEBUG = False
settings_keys = {}
try: try:
with open( with open(
os.path.join(os.path.dirname(__file__), "settings.toml"), "r" os.path.join(os.path.dirname(__file__), "settings.toml"), "r"
) as settings_file: ) as settings_file:
settings = toml.loads(settings_file.read()) settings = toml.loads(settings_file.read())
settings_keys = settings.keys()
except: except:
pass pass
settings_keys = settings.keys()
if "ping_retries" in settings_keys: if "ping_retries" in settings_keys:
NETWORK_PING_RETRIES: int = settings["ping_retries"] NETWORK_PING_RETRIES: int = settings["ping_retries"]
if "ping_timeout" in settings_keys: if "ping_timeout" in settings_keys: