aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-10-19 18:44:52 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-10-19 18:44:52 +0300
commit2c8eeb5555ceb195c3566fe22e82e8605bf263d5 (patch)
tree981201cacec3d868a11515379e470e716083b729
parentworkflows/ci: minor fixes (diff)
downloadcgitize-2c8eeb5555ceb195c3566fe22e82e8605bf263d5.tar.gz
cgitize-2c8eeb5555ceb195c3566fe22e82e8605bf263d5.zip
GitLab requires access in the username:access_token format
My bad for not testing it out before.
Diffstat (limited to '')
-rw-r--r--cgitize/config.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/cgitize/config.py b/cgitize/config.py
index 821dd6d..8922d17 100644
--- a/cgitize/config.py
+++ b/cgitize/config.py
@@ -70,6 +70,12 @@ class GitHubSection(Section):
return self.access_token
+def two_part_url_auth(username, password):
+ if username is None or password is None:
+ return None
+ return f'{username}:{password}'
+
+
class BitbucketSection(Section):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -86,11 +92,7 @@ class BitbucketSection(Section):
@property
def url_auth(self):
- username = self.username
- password = self.app_password
- if username is None or password is None:
- return None
- return f'{username}:{password}'
+ return two_part_url_auth(self.username, self.app_password)
def enum_repositories(self):
return map(HostedRepo, self.repositories.enum_repositories())
@@ -107,8 +109,12 @@ class GitLabSection(Section):
return self._get_config_or_env('access_token', 'CGITIZE_GITLAB_ACCESS_TOKEN')
@property
+ def username(self):
+ return self._get_config_or_env('username', 'CGITIZE_GITLAB_USERNAME')
+
+ @property
def url_auth(self):
- return self.access_token
+ return two_part_url_auth(self.username, self.access_token)
class UsersSection(Section):