diff options
author | Thomas Van Iseghem <[email protected]> | 2023-05-22 22:17:38 +0200 |
---|---|---|
committer | Thomas Van Iseghem <[email protected]> | 2023-05-22 22:17:38 +0200 |
commit | 565d8547a127e15167f4790d7c4e8479160e399e (patch) | |
tree | 0b717a9b5fc26a31077bf50d4ccc11346cd4754b | |
parent | 227ef6368670cd3983d404640ff2a84ad143b0a2 (diff) | |
download | OpenCortex-565d8547a127e15167f4790d7c4e8479160e399e.tar.gz OpenCortex-565d8547a127e15167f4790d7c4e8479160e399e.zip |
coros_downloader now uses config
-rw-r--r-- | Firmware-download/config.json | 10 | ||||
-rw-r--r-- | Firmware-download/coros_downloader.py | 21 |
2 files changed, 20 insertions, 11 deletions
diff --git a/Firmware-download/config.json b/Firmware-download/config.json new file mode 100644 index 0000000..7a3eb93 --- /dev/null +++ b/Firmware-download/config.json @@ -0,0 +1,10 @@ +{ + "service": "execute-api", + "host": "config-api.neuraldsp.com", + "endpoint": "/api/v1/config/firmware/latest", + "stage": "", + "firmwareType": "update_QC_rev5.bin", + "filename": "update", + "access_key": "raphael_zpu", + "secret_key": "a540MUwH+cjmBEg1mNFKKsXwoRerk/IPWoQP+UDFo0M=" +}
\ No newline at end of file diff --git a/Firmware-download/coros_downloader.py b/Firmware-download/coros_downloader.py index 58edd5b..4e2fc01 100644 --- a/Firmware-download/coros_downloader.py +++ b/Firmware-download/coros_downloader.py @@ -15,21 +15,20 @@ class CorOS_Downloader: "2.0.1": "cIR97IrfvF4fKfO5_KIm_j_aP2zGiHp_", } - # Hardcoded values, might be moved to a config file - service = "execute-api" - host = "config-api.neuraldsp.com" - endpoint = "/api/v1/config/firmware/latest" - stage = "" - firmwareType = "update_QC_rev5.bin" - filename = "update" - access_key = "raphael_zpu" - secret_key = "a540MUwH+cjmBEg1mNFKKsXwoRerk/IPWoQP+UDFo0M=" - def __init__(self, version, updatermode, download_dir): self.firmwareVersion = self.firmware_version_lut[version] self.download_dir = download_dir self.updatermode = updatermode - + + config = json.load(open("config.json")) + self.access_key = config["access_key"] + self.secret_key = config["secret_key"] + self.host = config["host"] + self.stage = config["stage"] + self.endpoint = config["endpoint"] + self.firmwareType = config["firmwareType"] + self.filename = config["filename"] + @property def url(self): return "https://{}{}{}".format(self.host, self.stage, self.endpoint) |