Merge pull request #62 from Marginal/Migration

Schema migration before migration end
This commit is contained in:
AnthorNet 2017-07-03 14:16:36 +02:00 committed by GitHub
commit d4f5202bf0
4 changed files with 23 additions and 6 deletions

View File

@ -37,6 +37,11 @@ statsCollector = StatsCollector()
statsCollector.start()
# Migration from schemas.elite-markets.net to eddn.edcd.io - Remove after transition complete!
import re
TRANSITION_RE = re.compile('^https://eddn.edcd.io/schemas/(.+)')
def configure():
# Get the list of transports to bind from settings. This allows us to PUB
# messages to multiple announcers over a variety of socket types
@ -145,6 +150,11 @@ def parse_and_error_handle(data):
if validationResults.severity <= ValidationSeverity.WARN:
parsed_message['header']['gatewayTimestamp'] = datetime.utcnow().isoformat() + 'Z'
# Migration from schemas.elite-markets.net to eddn.edcd.io - Remove after transition complete!
match = TRANSITION_RE.match(parsed_message['$schemaRef'])
if match and match.group(1):
parsed_message['$schemaRef'] = 'http://schemas.elite-markets.net/eddn/%s' % match.group(1)
ip_hash_salt = Settings.GATEWAY_IP_KEY_SALT
if ip_hash_salt:
# If an IP hash is set, salt+hash the uploader's IP address and set
@ -221,8 +231,8 @@ def main():
host=Settings.GATEWAY_HTTP_BIND_ADDRESS,
port=Settings.GATEWAY_HTTP_PORT,
server='gevent',
certfile='/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem',
keyfile='/etc/letsencrypt/live/eddn.edcd.io/privkey.pem'
certfile=Settings.CERT_FILE,
keyfile=Settings.KEY_FILE
)
if __name__ == '__main__':

View File

@ -258,8 +258,8 @@ def main():
host='0.0.0.0',
port=9091,
server='gevent',
certfile='/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem',
keyfile='/etc/letsencrypt/live/eddn.edcd.io/privkey.pem'
certfile=Settings.CERT_FILE,
keyfile=Settings.KEY_FILE
)

View File

@ -115,8 +115,8 @@ def main():
host=Settings.RELAY_HTTP_BIND_ADDRESS,
port=Settings.RELAY_HTTP_PORT,
server='gevent',
certfile='/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem',
keyfile='/etc/letsencrypt/live/eddn.edcd.io/privkey.pem'
certfile=Settings.CERT_FILE,
keyfile=Settings.KEY_FILE
)

View File

@ -9,6 +9,13 @@ class _Settings(object):
EDDN_VERSION = version
###############################################################################
# Local installation settings
###############################################################################
CERT_FILE = '/etc/letsencrypt/live/eddn.edcd.io/fullchain.pem'
KEY_FILE = '/etc/letsencrypt/live/eddn.edcd.io/privkey.pem'
###############################################################################
# Relay settings
###############################################################################