API - return weather api provider in app config route

This commit is contained in:
Sam
2022-12-28 11:43:36 +01:00
parent 52d31a68db
commit cd66952db9
3 changed files with 44 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
import os
from typing import Dict
from flask import current_app
@@ -43,6 +44,7 @@ class AppConfig(BaseModel):
return current_app.config['TILE_SERVER']['ATTRIBUTION']
def serialize(self) -> Dict:
weather_provider = os.getenv('WEATHER_API_PROVIDER', '').lower()
return {
'admin_contact': self.admin_contact,
'gpx_limit_import': self.gpx_limit_import,
@@ -53,6 +55,11 @@ class AppConfig(BaseModel):
'max_users': self.max_users,
'map_attribution': self.map_attribution,
'version': VERSION,
'weather_provider': (
weather_provider
if weather_provider in ['darksky', 'visualcrossing']
else None
),
}