Commit 91ede187 authored by Florian Walch's avatar Florian Walch

Use GITHUB_USERNAME config value.

parent 4f15ec3d
...@@ -194,6 +194,9 @@ ENABLE_HTTPS = getvalue('ENABLE_HTTPS', False) ...@@ -194,6 +194,9 @@ ENABLE_HTTPS = getvalue('ENABLE_HTTPS', False)
# Hiding repository credentials # Hiding repository credentials
HIDE_REPO_CREDENTIALS = getvalue('HIDE_REPO_CREDENTIALS', True) HIDE_REPO_CREDENTIALS = getvalue('HIDE_REPO_CREDENTIALS', True)
# GitHub username for sending pull requests
GITHUB_USERNAME = getvalue('GITHUB_USERNAME', None)
# Whiteboard # Whiteboard
ENABLE_WHITEBOARD = getvalue('ENABLE_WHITEBOARD', False) ENABLE_WHITEBOARD = getvalue('ENABLE_WHITEBOARD', False)
......
...@@ -33,6 +33,7 @@ from distutils.version import LooseVersion ...@@ -33,6 +33,7 @@ from distutils.version import LooseVersion
from dateutil import parser from dateutil import parser
from weblate.trans.util import get_clean_env, add_configuration_error from weblate.trans.util import get_clean_env, add_configuration_error
from weblate.trans.ssh import ssh_file, SSH_WRAPPER from weblate.trans.ssh import ssh_file, SSH_WRAPPER
from weblate import appsettings
VCS_REGISTRY = {} VCS_REGISTRY = {}
VCS_CHOICES = [] VCS_CHOICES = []
...@@ -636,19 +637,7 @@ class GithubRepository(GitRepository): ...@@ -636,19 +637,7 @@ class GithubRepository(GitRepository):
name = 'GitHub' name = 'GitHub'
_cmd = 'hub' _cmd = 'hub'
_hub_config_file = os.path.join(os.path.expanduser('~'), _hub_user = appsettings.GITHUB_USERNAME
'.config/hub')
_hub_user_prefix = '- user: '
_hub_user = None
if 'GITHUB_USER' in os.environ:
_hub_user = os.environ['GITHUB_USER']
elif os.path.isfile(_hub_config_file):
with open(_hub_config_file) as config_file:
for line in config_file.read().splitlines():
if line.startswith(_hub_user_prefix):
_hub_user = line[len(_hub_user_prefix):]
break
if _hub_user is None: if _hub_user is None:
_is_supported = False _is_supported = False
......
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