Skip to content

Commit 1a0fd9b

Browse files
authored
fix(env): fixup handling of default env service values (#314)
Fixes the mapping between default (eg. `COVERALLS_*`) env vars and the equivalent config values, which had some mismatches for job identification cases. Fixes #303
1 parent f5ebce6 commit 1a0fd9b

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

coveralls/api.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,18 @@ def load_config_from_environment(self):
214214
if parallel:
215215
self.config['parallel'] = parallel
216216

217-
repo_token = os.environ.get('COVERALLS_REPO_TOKEN')
218-
if repo_token:
219-
self.config['repo_token'] = repo_token
220-
221-
service_name = os.environ.get('COVERALLS_SERVICE_NAME')
222-
if service_name:
223-
self.config['service_name'] = service_name
224-
225-
flag_name = os.environ.get('COVERALLS_FLAG_NAME')
226-
if flag_name:
227-
self.config['flag_name'] = flag_name
228-
229-
number = os.environ.get('COVERALLS_SERVICE_JOB_NUMBER')
230-
if number:
231-
self.config['service_number'] = number
217+
fields = {
218+
'COVERALLS_FLAG_NAME': 'flag_name',
219+
'COVERALLS_REPO_TOKEN': 'repo_token',
220+
'COVERALLS_SERVICE_JOB_ID': 'service_job_id',
221+
'COVERALLS_SERVICE_JOB_NUMBER': 'service_job_number',
222+
'COVERALLS_SERVICE_NAME': 'service_name',
223+
'COVERALLS_SERVICE_NUMBER': 'service_number',
224+
}
225+
for var, key in fields.items():
226+
value = os.environ.get(var)
227+
if value:
228+
self.config[key] = value
232229

233230
def load_config_from_file(self):
234231
try:

0 commit comments

Comments
 (0)