Extracting token to env var
This commit is contained in:
parent
419d06c95b
commit
f4eb592b87
|
@ -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))
|
LDAP_TIMEOUT_SEC = int(environ.get('LDAP_TIMEOUT_SEC', default=1))
|
||||||
|
|
||||||
# Github token
|
# Github token
|
||||||
GH_TOKEN = '6cbd5f3a1764a8d15b27d66f64ac80ae13b393a9'
|
GITHUB_TOKEN = environ.get('GITHUB_TOKEN', None)
|
||||||
|
|
||||||
# Email configuration
|
# Email configuration
|
||||||
DEFAULT_SENDER = 'askresearch@virginia.edu'
|
DEFAULT_SENDER = 'askresearch@virginia.edu'
|
||||||
|
|
|
@ -60,8 +60,8 @@ class FileView(AdminModelView):
|
||||||
|
|
||||||
@action('publish', 'Publish', 'Are you sure you want to publish this file(s)?')
|
@action('publish', 'Publish', 'Are you sure you want to publish this file(s)?')
|
||||||
def action_publish(self, ids):
|
def action_publish(self, ids):
|
||||||
# TODO: Move token to settings and replace docs repo
|
# TODO: Replace docs repo
|
||||||
gh_token = app.config['GH_TOKEN']
|
gh_token = app.config['GITHUB_TOKEN']
|
||||||
_github = Github(gh_token)
|
_github = Github(gh_token)
|
||||||
repo = _github.get_user().get_repo('crispy-fiesta')
|
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)?')
|
@action('update', 'Update', 'Are you sure you want to update this file(s)?')
|
||||||
def action_update(self, ids):
|
def action_update(self, ids):
|
||||||
gh_token = app.config['GH_TOKEN']
|
gh_token = app.config['GITHUB_TOKEN']
|
||||||
_github = Github(gh_token)
|
_github = Github(gh_token)
|
||||||
repo = _github.get_user().get_repo('crispy-fiesta')
|
repo = _github.get_user().get_repo('crispy-fiesta')
|
||||||
|
|
||||||
|
@ -101,7 +101,6 @@ class FileView(AdminModelView):
|
||||||
# Add message indicating file is not in the repo
|
# Add message indicating file is not in the repo
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
import pdb; pdb.set_trace()
|
|
||||||
file_data_model.data = repo_file.decoded_content
|
file_data_model.data = repo_file.decoded_content
|
||||||
self.session.add(file_data_model)
|
self.session.add(file_data_model)
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
|
|
Loading…
Reference in New Issue