mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 21:33:59 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
62
tools/python/airmaps/instruments/settings.py
Normal file
62
tools/python/airmaps/instruments/settings.py
Normal file
@@ -0,0 +1,62 @@
|
||||
import sys
|
||||
from typing import AnyStr
|
||||
|
||||
from maps_generator.generator import settings
|
||||
|
||||
STORAGE_PREFIX = ""
|
||||
|
||||
# Storage settings
|
||||
WD_HOST = ""
|
||||
WD_LOGIN = ""
|
||||
WD_PASSWORD = ""
|
||||
|
||||
# Common section
|
||||
EMAILS = []
|
||||
|
||||
settings.LOGGING["loggers"]["airmaps"] = {
|
||||
"handlers": ["stdout", "file"],
|
||||
"level": "DEBUG",
|
||||
"propagate": True,
|
||||
}
|
||||
|
||||
|
||||
def get_airmaps_emails(emails: AnyStr):
|
||||
if not emails:
|
||||
return []
|
||||
|
||||
for ch in [",", ";", ":"]:
|
||||
emails.replace(ch, " ")
|
||||
|
||||
return list(filter(None, [e.strpip() for e in emails.join(" ")]))
|
||||
|
||||
|
||||
def init(default_settings_path: AnyStr):
|
||||
settings.init(default_settings_path)
|
||||
|
||||
# Try to read a config and to overload default settings
|
||||
cfg = settings.CfgReader(default_settings_path)
|
||||
|
||||
# Storage section
|
||||
global WD_HOST
|
||||
global WD_LOGIN
|
||||
global WD_PASSWORD
|
||||
|
||||
WD_HOST = cfg.get_opt("Storage", "WD_HOST", WD_HOST)
|
||||
WD_LOGIN = cfg.get_opt("Storage", "WD_LOGIN", WD_LOGIN)
|
||||
WD_PASSWORD = cfg.get_opt("Storage", "WD_PASSWORD", WD_PASSWORD)
|
||||
|
||||
# Common section
|
||||
global EMAILS
|
||||
emails = cfg.get_opt("Common", "EMAILS", "")
|
||||
EMAILS = get_airmaps_emails(emails)
|
||||
|
||||
# Import all contains from maps_generator.generator.settings.
|
||||
thismodule = sys.modules[__name__]
|
||||
for name in dir(settings):
|
||||
if not name.startswith("_") and name.isupper():
|
||||
value = getattr(settings, name)
|
||||
setattr(thismodule, name, value)
|
||||
|
||||
global STORAGE_PREFIX
|
||||
if settings.DEBUG:
|
||||
STORAGE_PREFIX = "/tests"
|
||||
Reference in New Issue
Block a user