modified get_remote_url to use configuration, instead of hard-coding the remote host
This commit is contained in:
parent
7a99859108
commit
88b662ea38
|
@ -79,11 +79,11 @@ GITHUB_REPO = environ.get('GITHUB_REPO', None)
|
|||
TARGET_BRANCH = environ.get('TARGET_BRANCH', None)
|
||||
|
||||
# Git settings, used by git_service
|
||||
# The above Github settings--used in file_service, will likely be deprecated
|
||||
# You can override these settings in instance/config
|
||||
GIT_REMOTE_PATH = environ.get('GIT_REMOTE_PATH', None)
|
||||
GIT_BRANCH = environ.get('GIT_BRANCH', None)
|
||||
GIT_MERGE_BRANCH = environ.get('GIT_MERGE_BRANCH', None) # Developers can set this to 'all' in instance.config
|
||||
# Among other things, we use these to build a remote URL like https://username:password@host/path.git
|
||||
GIT_REMOTE_SERVER = environ.get('GIT_REMOTE_SERVER', None) # example: 'github.com'
|
||||
GIT_REMOTE_PATH = environ.get('GIT_REMOTE_PATH', None) # example: 'sartography/crconnect-workflow-specs
|
||||
GIT_BRANCH = environ.get('GIT_BRANCH', None) # example: 'main'
|
||||
GIT_MERGE_BRANCH = environ.get('GIT_MERGE_BRANCH', None) # Example: 'staging'
|
||||
|
||||
# Email configuration
|
||||
DEFAULT_SENDER = 'uvacrconnect@virginia.edu'
|
||||
|
|
|
@ -29,11 +29,10 @@ class GitService(object):
|
|||
|
||||
@staticmethod
|
||||
def get_remote_url(remote_path):
|
||||
# we use github
|
||||
# Note that the 'password' is a token generated by github, not the site password
|
||||
host = app.config['GIT_REMOTE_SERVER']
|
||||
username = app.config["GIT_USER_NAME"]
|
||||
password = app.config["GIT_USER_PASS"]
|
||||
remote_url = f"https://{username}:{password}@github.com/{remote_path}.git"
|
||||
remote_url = f"https://{username}:{password}@{host}/{remote_path}.git"
|
||||
return remote_url
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue