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