SolarEnergy/python_device/src/args.py

27 lines
921 B
Python
Raw Normal View History

2024-06-29 16:05:58 +00:00
import argparse
import os
2024-07-01 19:10:45 +00:00
parser = argparse.ArgumentParser(description="SolarEnergy Python-based client")
2024-06-29 16:05:58 +00:00
2024-07-01 19:10:45 +00:00
parser.add_argument(
"--unsecure_origin",
help="Change unsecure API origin",
default="http://localhost:8080",
)
2024-06-29 16:05:58 +00:00
parser.add_argument("--storage", help="Change storage location", default="storage")
2024-07-01 19:10:45 +00:00
parser.add_argument(
"--relay_gpios",
help="Comma-separated list of GPIO used to modify relays",
default="5,6,7",
)
2024-06-29 16:05:58 +00:00
args = parser.parse_args()
2024-06-29 16:08:57 +00:00
args.secure_origin_path = os.path.join(args.storage, "SECURE_ORIGIN")
2024-07-01 19:10:45 +00:00
args.root_ca_path = os.path.join(args.storage, "root_ca.crt")
args.dev_id_path = os.path.join(args.storage, "DEV_ID")
2024-06-30 08:14:42 +00:00
args.dev_priv_key_path = os.path.join(args.storage, "dev.key")
2024-07-01 19:10:45 +00:00
args.dev_csr_path = os.path.join(args.storage, "dev.csr")
args.dev_crt_path = os.path.join(args.storage, "dev.crt")
args.relay_gpios_list = list(map(lambda x: int(x), args.relay_gpios.split(",")))