mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-24 12:20:54 +03:00
Settings: flake8 and mypy passes
Yes, we want to keep the extra-spaces formatting, but that means noqa'ing E221.
This commit is contained in:
parent
dd7e12fa28
commit
8fb722f6c5
@ -1,6 +1,11 @@
|
||||
# coding: utf8
|
||||
"""EDDN default Settings."""
|
||||
|
||||
import argparse
|
||||
from typing import Dict
|
||||
|
||||
import simplejson
|
||||
|
||||
from eddn.conf.Version import __version__ as version
|
||||
|
||||
|
||||
@ -12,64 +17,64 @@ class _Settings(object):
|
||||
# Local installation settings
|
||||
###############################################################################
|
||||
|
||||
CERT_FILE = '/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem'
|
||||
KEY_FILE = '/etc/letsencrypt/live/eddn.edcd.io/privkey.pem'
|
||||
CERT_FILE = '/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem' # noqa: E221
|
||||
KEY_FILE = '/etc/letsencrypt/live/eddn.edcd.io/privkey.pem' # noqa: E221
|
||||
|
||||
###############################################################################
|
||||
# Relay settings
|
||||
###############################################################################
|
||||
|
||||
RELAY_HTTP_BIND_ADDRESS = "0.0.0.0"
|
||||
RELAY_HTTP_PORT = 9090
|
||||
RELAY_HTTP_BIND_ADDRESS = "0.0.0.0" # noqa: E221
|
||||
RELAY_HTTP_PORT = 9090 # noqa: E221
|
||||
|
||||
RELAY_RECEIVER_BINDINGS = ["tcp://127.0.0.1:8500"]
|
||||
RELAY_RECEIVER_BINDINGS = ["tcp://127.0.0.1:8500"] # noqa: E221
|
||||
|
||||
RELAY_SENDER_BINDINGS = ["tcp://*:9500"]
|
||||
RELAY_SENDER_BINDINGS = ["tcp://*:9500"] # noqa: E221
|
||||
|
||||
# If set to False, no deduplicate is made
|
||||
RELAY_DUPLICATE_MAX_MINUTES = 15
|
||||
RELAY_DUPLICATE_MAX_MINUTES = 15 # noqa: E221
|
||||
|
||||
# If set to false, don't listen to topic and accept all incoming messages
|
||||
RELAY_RECEIVE_ONLY_GATEWAY_EXTRA_JSON = True
|
||||
RELAY_RECEIVE_ONLY_GATEWAY_EXTRA_JSON = True # noqa: E221
|
||||
|
||||
RELAY_EXTRA_JSON_SCHEMAS = {}
|
||||
RELAY_EXTRA_JSON_SCHEMAS: Dict = {} # noqa: E221
|
||||
|
||||
###############################################################################
|
||||
# Gateway settings
|
||||
###############################################################################
|
||||
|
||||
GATEWAY_HTTP_BIND_ADDRESS = "127.0.0.1"
|
||||
GATEWAY_HTTP_PORT = 8081
|
||||
GATEWAY_HTTP_BIND_ADDRESS = "127.0.0.1" # noqa: E221
|
||||
GATEWAY_HTTP_PORT = 8081 # noqa: E221
|
||||
|
||||
GATEWAY_SENDER_BINDINGS = ["tcp://127.0.0.1:8500"]
|
||||
GATEWAY_SENDER_BINDINGS = ["tcp://127.0.0.1:8500"] # noqa: E221
|
||||
|
||||
GATEWAY_JSON_SCHEMAS = {
|
||||
"https://eddn.edcd.io/schemas/commodity/3" : "schemas/commodity-v3.0.json",
|
||||
"https://eddn.edcd.io/schemas/commodity/3/test" : "schemas/commodity-v3.0.json",
|
||||
GATEWAY_JSON_SCHEMAS = { # noqa: E221
|
||||
"https://eddn.edcd.io/schemas/commodity/3": "schemas/commodity-v3.0.json",
|
||||
"https://eddn.edcd.io/schemas/commodity/3/test": "schemas/commodity-v3.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/shipyard/2" : "schemas/shipyard-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/shipyard/2/test" : "schemas/shipyard-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/shipyard/2": "schemas/shipyard-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/shipyard/2/test": "schemas/shipyard-v2.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/outfitting/2" : "schemas/outfitting-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/outfitting/2/test" : "schemas/outfitting-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/outfitting/2": "schemas/outfitting-v2.0.json",
|
||||
"https://eddn.edcd.io/schemas/outfitting/2/test": "schemas/outfitting-v2.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/blackmarket/1" : "schemas/blackmarket-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/blackmarket/1/test" : "schemas/blackmarket-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/blackmarket/1": "schemas/blackmarket-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/blackmarket/1/test": "schemas/blackmarket-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/journal/1" : "schemas/journal-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/journal/1/test" : "schemas/journal-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/journal/1": "schemas/journal-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/journal/1/test": "schemas/journal-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/scanbarycentre/1" : "schemas/scanbarycentre-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/scanbarycentre/1/test" : "schemas/scanbarycentre-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/scanbarycentre/1": "schemas/scanbarycentre-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/scanbarycentre/1/test": "schemas/scanbarycentre-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1" : "schemas/fssdiscoveryscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1/test" : "schemas/fssdiscoveryscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1": "schemas/fssdiscoveryscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1/test": "schemas/fssdiscoveryscan-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/codexentry/1" : "schemas/codexentry-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/codexentry/1/test" : "schemas/codexentry-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/codexentry/1": "schemas/codexentry-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/codexentry/1/test": "schemas/codexentry-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/navbeaconscan/1" : "schemas/navbeaconscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/navbeaconscan/1/test" : "schemas/navbeaconscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/navbeaconscan/1": "schemas/navbeaconscan-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/navbeaconscan/1/test": "schemas/navbeaconscan-v1.0.json",
|
||||
|
||||
"https://eddn.edcd.io/schemas/navroute/1" : "schemas/navroute-v1.0.json",
|
||||
"https://eddn.edcd.io/schemas/navroute/1/test" : "schemas/navroute-v1.0.json",
|
||||
@ -86,7 +91,7 @@ class _Settings(object):
|
||||
"https://eddn.edcd.io/schemas/fsssignaldiscovered/1/test" : "schemas/fsssignaldiscovered-v1.0.json",
|
||||
}
|
||||
|
||||
GATEWAY_OUTDATED_SCHEMAS = [
|
||||
GATEWAY_OUTDATED_SCHEMAS = [ # noqa: E221
|
||||
"http://schemas.elite-markets.net/eddn/commodity/1",
|
||||
"http://schemas.elite-markets.net/eddn/commodity/1/test",
|
||||
"http://schemas.elite-markets.net/eddn/commodity/2",
|
||||
@ -111,40 +116,42 @@ class _Settings(object):
|
||||
# Monitor settings
|
||||
###############################################################################
|
||||
|
||||
MONITOR_HTTP_BIND_ADDRESS = "0.0.0.0"
|
||||
MONITOR_HTTP_PORT = 9091
|
||||
MONITOR_HTTP_BIND_ADDRESS = "0.0.0.0" # noqa: E221
|
||||
MONITOR_HTTP_PORT = 9091 # noqa: E221
|
||||
|
||||
MONITOR_RECEIVER_BINDINGS = ["tcp://127.0.0.1:8500"]
|
||||
MONITOR_RECEIVER_BINDINGS = ["tcp://127.0.0.1:8500"] # noqa: E221
|
||||
|
||||
MONITOR_DB = {
|
||||
MONITOR_DB = { # noqa: E221
|
||||
"user": "eddn",
|
||||
"password": "cvLYM8AEqg29YTatFMEcqph3YkDWUMvC",
|
||||
"database": "eddn"
|
||||
}
|
||||
|
||||
MONITOR_UA = "UA-496332-23"
|
||||
MONITOR_UA = "UA-496332-23" # noqa: E221
|
||||
|
||||
##########################################################################
|
||||
# Bouncer settings
|
||||
##########################################################################
|
||||
BOUNCER_HTTP_BIND_ADDRESS = "127.0.0.1"
|
||||
BOUNCER_HTTP_PORT = 8081
|
||||
BOUNCER_HTTP_BIND_ADDRESS = "127.0.0.1" # noqa: E221
|
||||
BOUNCER_HTTP_PORT = 8081 # noqa: E221
|
||||
|
||||
BOUNCER_LIVE_GATEWAY_URL = 'https://eddn.edcd.io:4430/upload/'
|
||||
|
||||
def loadFrom(self, fileName):
|
||||
f = open(fileName, 'r')
|
||||
def load_from(self, file_name: str) -> None:
|
||||
f = open(file_name, 'r')
|
||||
conf = simplejson.load(f)
|
||||
for key, value in conf.iteritems():
|
||||
if key in dir(self):
|
||||
self.__setattr__(key, value)
|
||||
|
||||
else:
|
||||
print "Ignoring unknown setting {0}".format(key)
|
||||
print(f"Ignoring unknown setting {key}")
|
||||
|
||||
|
||||
Settings = _Settings()
|
||||
|
||||
|
||||
def loadConfig(cl_args):
|
||||
def loadConfig(cl_args) -> None:
|
||||
"""
|
||||
Load in a commandline-specified settings file, if applicable.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user