mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
17 lines
609 B
Python
17 lines
609 B
Python
import argparse
|
|
import configparser
|
|
|
|
# Parse command-line arguments
|
|
parser = argparse.ArgumentParser(description="MeshView Configuration Loader")
|
|
parser.add_argument(
|
|
"--config", type=str, default="config.ini", help="Path to config.ini file (default: config.ini)"
|
|
)
|
|
args, _ = parser.parse_known_args()
|
|
|
|
# Initialize config parser
|
|
config_parser = configparser.ConfigParser()
|
|
if not config_parser.read(args.config):
|
|
raise FileNotFoundError(f"Config file '{args.config}' not found! Ensure the file exists.")
|
|
|
|
CONFIG = {section: dict(config_parser.items(section)) for section in config_parser.sections()}
|