diff options
-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) |