mirror of
https://github.com/NohamR/LetCTF.git
synced 2026-05-24 19:59:20 +00:00
first push
This commit is contained in:
18
src/utils/config_handler.py
Normal file
18
src/utils/config_handler.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import json
|
||||
from typing import Dict
|
||||
from pathlib import Path
|
||||
|
||||
def load_config(file_path: str | Path) -> Dict:
|
||||
"""Load configuration from a JSON file
|
||||
Expected format:
|
||||
{
|
||||
"token": "your_token",
|
||||
"provider": "provider_name"
|
||||
}
|
||||
"""
|
||||
path = Path(file_path)
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(f"Config file not found: {file_path}")
|
||||
|
||||
with open(path, 'r') as f:
|
||||
return json.load(f)
|
||||
Reference in New Issue
Block a user