Commit dd5721b9 authored by Sofus Rose's avatar Sofus Rose

Added env notes - script todo. Script now has project-specific tokens.

parent 24e7df0a
......@@ -10,7 +10,6 @@ import os, os.path
#For this to work,
github_user = open('/opt/git-repos/github-user', 'r').readlines()[0].rstrip()
TOKEN = open('/opt/git-repos/token', 'r').readlines()[0].rstrip()
app = Flask(__name__)
......@@ -21,8 +20,10 @@ def foo():
print("New commit by: {}".format(data['commits'][0]['author']['name']), file=sys.stderr)
print("Header: ", request.headers)
proj_name = data['project']['name']
TOKEN = open('/opt/git-repos/token_{}'.format(proj_name), 'r').readlines()[0].rstrip()
if request.headers['X-Gitlab-Token'] == TOKEN :
proj_name = data['project']['name']
github_link = '{0}/{1}.git'.format(github_user, proj_name)
gitlab_link = data['project']['git_http_url']
repo_path = "/opt/git-repos/{}".format(proj_name)
# /opt/git-repos must exist and be rw by the user running the service.
# /opt/git-repos/github-user must exist and contain the string of the github user.
# The user running the service must have github pull/push permissions via ssh key.
# (I wouldn't run this on anything except LAN! Use commit signing.)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment