Extracting token to env var

This commit is contained in:
Carlos Lopez 2020-07-17 12:10:55 -06:00
parent 419d06c95b
commit f4eb592b87
2 changed files with 4 additions and 5 deletions

View File

@ -46,7 +46,7 @@ LDAP_URL = environ.get('LDAP_URL', default="ldap.virginia.edu").strip('/') # No
LDAP_TIMEOUT_SEC = int(environ.get('LDAP_TIMEOUT_SEC', default=1))
# Github token
GH_TOKEN = '6cbd5f3a1764a8d15b27d66f64ac80ae13b393a9'
GITHUB_TOKEN = environ.get('GITHUB_TOKEN', None)
# Email configuration
DEFAULT_SENDER = 'askresearch@virginia.edu'

View File

@ -60,8 +60,8 @@ class FileView(AdminModelView):
@action('publish', 'Publish', 'Are you sure you want to publish this file(s)?')
def action_publish(self, ids):
# TODO: Move token to settings and replace docs repo
gh_token = app.config['GH_TOKEN']
# TODO: Replace docs repo
gh_token = app.config['GITHUB_TOKEN']
_github = Github(gh_token)
repo = _github.get_user().get_repo('crispy-fiesta')
@ -85,7 +85,7 @@ class FileView(AdminModelView):
@action('update', 'Update', 'Are you sure you want to update this file(s)?')
def action_update(self, ids):
gh_token = app.config['GH_TOKEN']
gh_token = app.config['GITHUB_TOKEN']
_github = Github(gh_token)
repo = _github.get_user().get_repo('crispy-fiesta')
@ -101,7 +101,6 @@ class FileView(AdminModelView):
# Add message indicating file is not in the repo
pass
else:
import pdb; pdb.set_trace()
file_data_model.data = repo_file.decoded_content
self.session.add(file_data_model)
self.session.commit()