Commit 64c6a845 authored by Matthias's avatar Matthias
Browse files

use topicnames from configmap

parent 95a789d9
Pipeline #25037 passed with stages
in 2 minutes and 1 second
......@@ -39,6 +39,8 @@ def create_app(test_config=None):
app.config['drupal-password'] = os.environ['DRUPAL_PASSWORD']
app.config['drupal-api-url'] = os.environ['DRUPAL_API_URL']
app.config['drupal-api-key'] = os.environ['DRUPAL_API_KEY']
app.config['topic-configs'] = os.environ['TOPIC_CONFIGS']
app.config['topic-drupal-export'] = os.environ['TOPIC_DRUPAL_EXPORT']
app.config['sftp_host'] = os.environ['SFTP_HOST']
app.config['sftp_port'] = os.environ['SFTP_PORT']
app.config['sftp_user'] = os.environ['SFTP_USER']
......
......@@ -14,3 +14,5 @@ importApiConfig: import-api-prod-config
importApiUrl: 'https://{{ .Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl: 'https://memobase-customer-live.outermedia.net'
topicConfigs: 'mb-di-config-prod'
topicDrupalExport: 'mb-gi-drupal-export-prod'
......@@ -14,3 +14,5 @@ importApiConfig: import-api-test-config
importApiUrl: 'https://{{ .Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl: 'https://mb-wf1.memobase.unibas.ch'
topicConfigs: 'mb-di-config-stage'
topicDrupalExport: 'mb-gi-drupal-export-stage'
......@@ -14,3 +14,5 @@ importApiConfig: import-api-test-config
importApiUrl: 'https://{{ .Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl: 'https://mb-wf1.memobase.unibas.ch'
topicConfigs: 'mb-di-config-test'
topicDrupalExport: 'mb-gi-drupal-export-test'
......@@ -84,7 +84,7 @@ class FetchMappingFile(Resource):
raise ImportApiError(message)
# 2. write file content into kafka topic
topic = 'mb-di-config-prod'
topic = current_app.config['topic-configs']
try:
producer = KafkaProducer(bootstrap_servers=current_app.config['kafka-broker-url'],
key_serializer=str.encode)
......
......@@ -146,7 +146,7 @@ class MonitorDrupalJsonApiInstitution(Resource):
value_serializer=lambda m: json.dumps(m, ensure_ascii=False)
.encode('utf-8'))
key = bytes(topic_value.get('field_memobase_id'), encoding='utf-8')
producer.send('mb-gi-drupal-export-prod', topic_value, key)
producer.send(current_app.config['topic-drupal-export'], topic_value, key)
except Exception as ex:
msg = 'Exception for ' + institutionId + ': ' + str(ex) + '\n' + \
traceback.format_exc()
......
......@@ -211,7 +211,7 @@ class MonitorDrupalJsonApiRecordSet(Resource):
value_serializer=lambda m: json.dumps(m, ensure_ascii=False)
.encode('utf-8'))
key = bytes(topicValue.get('field_memobase_id'), encoding='utf-8')
producer.send('mb-gi-drupal-export-prod', topicValue, key=key)
producer.send(current_app.config['topic-drupal-export'], topicValue, key=key)
except Exception as ex:
msg = 'Exception for ' + recordSetId + ': ' + str(ex) + '\n' +\
traceback.format_exc()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment