Reorganize API keys under [External_Data] section

- Move n2yo_api_key and airnow_api_key from [Solar_Config] to [External_Data]
- Update code references to use [External_Data] section instead of [Solar_Config]
- Update config.ini.example to match the new organization
- Improve error message to specify the correct config section
- This provides better organization with all external API keys in one place
This commit is contained in:
agessaman
2025-09-06 11:37:45 -07:00
parent 9b74a39872
commit de92fdfdd2
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ class AqiCommand(BaseCommand):
self.default_state = self.bot.config.get('Weather', 'default_state', fallback='WA')
# Get AirNow API key from config
self.api_key = self.bot.config.get('Solar_Config', 'airnow_api_key', fallback='')
self.api_key = self.bot.config.get('External_Data', 'airnow_api_key', fallback='')
if not self.api_key:
self.logger.warning("AirNow API key not configured in config.ini")
@@ -283,7 +283,7 @@ class AqiCommand(BaseCommand):
"""Get AQI data for a location (zipcode, city, or coordinates)"""
try:
if not self.api_key:
return "AirNow API key not configured. Please add airnow_api_key to config.ini"
return "AirNow API key not configured. Please add airnow_api_key to [External_Data] section in config.ini"
# Convert location to lat/lon
if location_type == "zipcode":
+1 -1
View File
@@ -353,7 +353,7 @@ def get_next_satellite_pass(satellite, lat=None, lon=None):
lon = get_config_value('Solar_Config', 'default_longitude', DEFAULT_LONGITUDE)
# API URL
n2yo_key = get_config_value('Solar_Config', 'n2yo_api_key', DEFAULT_N2YO_API_KEY)
n2yo_key = get_config_value('External_Data', 'n2yo_api_key', DEFAULT_N2YO_API_KEY)
if not n2yo_key:
logger.error("System: Missing API key free at https://www.n2yo.com/login/")
return "not configured, bug your sysop"