Commit 4260b6bc authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Update user agent.

Change url to https
parent 7160a064
Pipeline #34099 failed with stages
in 1 minute and 23 seconds
......@@ -4,8 +4,9 @@ metadata:
name: "{{ .Values.deploymentName }}-app-config"
namespace: memobase
data:
API_ENDPOINT_URL: "http://{{ .Values.importApiName }}-{{ .Values.k8sEnvironment}}-service:{{ .Values.importApiPort}}{{ .Values.importApiPath }}"
API_ENDPOINT_URL: "https://{{ .Values.importApiName }}-{{ .Values.k8sEnvironment}}-service:{{ .Values.importApiPort}}{{ .Values.importApiPath }}"
STEP_WHITE_LIST_FILE_PATH: "{{ .Values.whitelistFilePath }}"
ENVIRONMENT: "{{.Values.k8sEnvironment }}"
APPLICATION_ID: "{{ .Values.deploymentName }}-{{ .Values.k8sEnvironment }}-app"
TOPIC_IN: "{{ .Values.inputTopic }}"
TOPIC_OUT: "not-used"
......
......@@ -23,7 +23,7 @@ import org.apache.logging.log4j.LogManager
import java.net.HttpURLConnection
import java.net.URL
class ReportCollector(private val importApiUrl: String) {
class ReportCollector(importApiUrl: String, private val env: String) {
private val log = LogManager.getLogger(this::class.java)
private val collection = mutableMapOf<String, ProcessReport>()
private val requiredStepsForInstitutions = 4
......@@ -68,6 +68,7 @@ class ReportCollector(private val importApiUrl: String) {
http.doOutput = true
http.setFixedLengthStreamingMode(it.second.size)
http.setRequestProperty("Content-Type", "application/json; charset=UTF-8")
http.setRequestProperty("User-Agent", "gi-reports-consumer-$env")
http.connect()
http.outputStream.use { os -> os.write(it.second) }
if (http.responseCode >= 400) {
......
......@@ -24,6 +24,7 @@ class Service(file: String = "app.yml") {
companion object {
const val importApiUrlSettingName = "importApiUrl"
const val whitelistFilePathSettingName = "whitelistFilePath"
const val envPropName = "env"
}
private val log = LogManager.getLogger("GroupReportsConsumerService")
......@@ -31,7 +32,8 @@ class Service(file: String = "app.yml") {
private val settings = SettingsLoader(
listOf(
importApiUrlSettingName,
whitelistFilePathSettingName
whitelistFilePathSettingName,
envPropName
),
file,
useConsumerConfig = true,
......@@ -44,7 +46,7 @@ class Service(file: String = "app.yml") {
private val importApiUrl = settings.appSettings[importApiUrlSettingName] as String
private val stepWhitelist = StepWhitelist(settings.appSettings[whitelistFilePathSettingName] as String)
val collector = ReportCollector(importApiUrl)
private val collector = ReportCollector(importApiUrl, settings.appSettings.getProperty(envPropName))
fun run() {
log.info("Begin reading from topic ${settings.inputTopic} on kafka cluster.")
......
app:
importApiUrl: ${API_ENDPOINT_URL:?system}
whitelistFilePath: ${STEP_WHITE_LIST_FILE_PATH:?system}
env: ${ENVIRONMENT:?system}
kafka:
consumer:
bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system}
......
Markdown is supported
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