Skip to content

Commit 2efc9f6

Browse files
committed
propagate API_TIMEOUT env var to call configuration
1 parent eda30c3 commit 2efc9f6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docker/sync.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ commands:
77
duration: PT1H
88
tags: ['%PROJECT%']
99
text: resync + reindex in progress
10+
api_timeout: "$API_TIMEOUT"
1011
- command:
1112
args: [opengrok-mirror, -c, '/opengrok/etc/mirror.yml',
1213
--api_timeout, '%API_TIMEOUT%',
@@ -27,10 +28,12 @@ commands:
2728
data: 'resync + reindex in progress'
2829
headers:
2930
'Content-type': 'text/plain'
31+
api_timeout: "$API_TIMEOUT"
3032
cleanup:
3133
- call:
3234
uri: '%URL%api/v1/messages?tag=%PROJECT%'
3335
method: DELETE
3436
data: 'resync + reindex in progress'
3537
headers:
3638
'Content-type': 'text/plain'
39+
api_timeout: "$API_TIMEOUT"

tools/src/main/python/opengrok_tools/utils/commandsequence.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#
2323

2424
import logging
25+
import os
2526

2627
from requests.exceptions import RequestException
2728

@@ -134,7 +135,10 @@ def __init__(self, call_dict):
134135
self.api_timeout = None
135136
call_timeout = call_dict.get(API_TIMEOUT_PROPERTY)
136137
if call_timeout:
137-
self.api_timeout = call_timeout
138+
if call_timeout.startswith("$"):
139+
call_timeout = os.environ.get(call_timeout[1:], "")
140+
if call_timeout.isdigit():
141+
self.api_timeout = call_timeout
138142

139143
self.async_api_timeout = None
140144
call_api_timeout = call_dict.get(ASYNC_API_TIMEOUT_PROPERTY)

0 commit comments

Comments
 (0)