added settings.toml file and used settings.py to get data from it
This commit is contained in:
24
settings.py
24
settings.py
@@ -1,7 +1,21 @@
|
|||||||
NETWORK_PING_RETRIES: int = 3
|
import toml
|
||||||
NETWORK_PING_TIMEOUT: int = 5
|
import os
|
||||||
NETWORK_SCAN_THREADS: int = 300
|
|
||||||
|
|
||||||
CFG_UTIL_CONFIG_THREADS: int = 300
|
try:
|
||||||
|
with open(os.path.join(os.getcwd(), "settings.toml"), "r") as settings_file:
|
||||||
|
settings = toml.loads(settings_file.read())
|
||||||
|
NETWORK_PING_RETRIES: int = settings["ping_retries"]
|
||||||
|
NETWORK_PING_TIMEOUT: int = settings["ping_timeout"]
|
||||||
|
NETWORK_SCAN_THREADS: int = settings["scan_threads"]
|
||||||
|
|
||||||
MINER_FACTORY_GET_VERSION_RETRIES: int = 3
|
CFG_UTIL_CONFIG_THREADS: int = settings["config_threads"]
|
||||||
|
|
||||||
|
MINER_FACTORY_GET_VERSION_RETRIES: int = settings["get_version_retries"]
|
||||||
|
except:
|
||||||
|
NETWORK_PING_RETRIES: int = 3
|
||||||
|
NETWORK_PING_TIMEOUT: int = 5
|
||||||
|
NETWORK_SCAN_THREADS: int = 300
|
||||||
|
|
||||||
|
CFG_UTIL_CONFIG_THREADS: int = 300
|
||||||
|
|
||||||
|
MINER_FACTORY_GET_VERSION_RETRIES: int = 3
|
||||||
|
|||||||
5
settings.toml
Normal file
5
settings.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
get_version_retries = 3
|
||||||
|
ping_retries = 3
|
||||||
|
ping_timeout = 5
|
||||||
|
scan_threads = 300
|
||||||
|
config_threads = 300
|
||||||
Reference in New Issue
Block a user