gitlab: tweak key logic
This commit is contained in:
parent
b12f98ae6e
commit
6bcef4e307
|
@ -22,13 +22,16 @@ async def get_version(name, conf, **kwargs):
|
|||
ignored_tags = conf.get("ignored_tags", "").split()
|
||||
sort_version_key = sort_version_keys[conf.get("sort_version_key", "parse_version")]
|
||||
|
||||
env_name = "NVCHECKER_GITLAB_TOKEN_" + host.upper().replace(".", "_").replace("/", "_")
|
||||
global_key = os.environ.get(env_name)
|
||||
if not global_key:
|
||||
key_name = 'gitlab_' + host.lower().replace('.', '_')
|
||||
global_key = kwargs['keyman'].get_key(key_name)
|
||||
token = conf.get('token')
|
||||
|
||||
if token is None:
|
||||
env_name = "NVCHECKER_GITLAB_TOKEN_" + host.upper().replace(".", "_").replace("/", "_")
|
||||
global_key = os.environ.get(env_name)
|
||||
if not global_key:
|
||||
key_name = 'gitlab_' + host.lower().replace('.', '_').replace("/", "_")
|
||||
global_key = kwargs['keyman'].get_key(key_name)
|
||||
token = global_key
|
||||
|
||||
token = conf.get('token', global_key)
|
||||
if token is None:
|
||||
logger.error('No gitlab token specified.', name=name)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue