introduced constants file

pull/908/head
DJ2LS 2025-03-10 09:34:32 +01:00
parent 729fed3ba5
commit a4fcdf7b17
4 changed files with 14 additions and 17 deletions

View File

@ -0,0 +1,9 @@
# Module for saving some constants
CONFIG_ENV_VAR = 'FREEDATA_CONFIG'
DEFAULT_CONFIG_FILE = 'config.ini'
MODEM_VERSION = "0.16.11-alpha"
API_VERSION = 3
LICENSE = 'GPL3.0'
DOCUMENTATION_URL = 'https://wiki.freedata.app'
STATS_API_URL = 'https://api.freedata.app/stats.php'
EXPLORER_API_URL = 'https://api.freedata.app/explorer.php'

View File

@ -8,11 +8,9 @@ Created on 05.11.23
# pylint: disable=import-outside-toplevel, attribute-defined-outside-init # pylint: disable=import-outside-toplevel, attribute-defined-outside-init
import requests import requests
import threading
import json import json
import structlog import structlog
import sched from constants import EXPLORER_API_URL
import time
log = structlog.get_logger("explorer") log = structlog.get_logger("explorer")
@ -22,7 +20,7 @@ class Explorer:
self.config_manager = config_manager self.config_manager = config_manager
self.config = self.config_manager.read() self.config = self.config_manager.read()
self.states = states self.states = states
self.explorer_url = "https://api.freedata.app/explorer.php" self.explorer_url = EXPLORER_API_URL
def push(self): def push(self):
self.config = self.config_manager.read() self.config = self.config_manager.read()

View File

@ -35,14 +35,7 @@ from api.radio import router as radio_router
from api.modem import router as modem_router from api.modem import router as modem_router
from api.freedata import router as freedata_router from api.freedata import router as freedata_router
from api.websocket import router as websocket_router from api.websocket import router as websocket_router
from constants import CONFIG_ENV_VAR, DEFAULT_CONFIG_FILE, MODEM_VERSION, API_VERSION, LICENSE, DOCUMENTATION_URL
# Constants
CONFIG_ENV_VAR = 'FREEDATA_CONFIG'
DEFAULT_CONFIG_FILE = 'config.ini'
MODEM_VERSION = "0.16.11-alpha"
API_VERSION = 3
LICENSE = 'GPL3.0'
DOCUMENTATION_URL = 'https://wiki.freedata.app'
# adjust asyncio for windows usage for avoiding a Assertion Error # adjust asyncio for windows usage for avoiding a Assertion Error
if sys.platform == 'win32': if sys.platform == 'win32':

View File

@ -9,16 +9,13 @@ Created on 05.11.23
import requests import requests
import json import json
import structlog import structlog
from constants import MODEM_VERSION, STATS_API_URL
log = structlog.get_logger("stats") log = structlog.get_logger("stats")
# we have to move the modem version, its a duplicate
MODEM_VERSION = "0.16.12-alpha"
class stats(): class stats():
def __init__(self, config, event_manager, states): def __init__(self, config, event_manager, states):
self.api_url = "https://api.freedata.app/stats.php" self.api_url = STATS_API_URL
self.states = states self.states = states
self.config = config self.config = config
self.event_manager = event_manager self.event_manager = event_manager