Commit 602c0e73 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

Hide gitlab token for utils/follow_transfer.py

parent 955b2703
Pipeline #4218 passed with stages
in 38 seconds
......@@ -5,6 +5,6 @@ timeout = 10
[irma]
url = https://gitlab.math.unistra.fr
PRIVATE_TOKEN = FByQxzgdXbgJC5Pis_s7
PRIVATE_TOKEN = { SECRET_TOKEN }
api_version = 4
......@@ -15,15 +15,22 @@ from pelican.utils import slugify
GITLAB_PROJECT_ID = 309 # Project id that holds the target issue
GITLAB_ISSUE_ID = 49 # Target issue id
CONFIG_FILE = ".python-gitlab.cfg"
GITLAB_URL = 'https://gitlab.math.unistra.fr'
TOCLEAN_DIR = "content_not_clean_yet"
CLEANED_DIR = "content"
def connect_to_gitlab(gitlab_id=None):
def connect_to_gitlab(gitlab_url=GITLAB_URL):
"""Return a connection to GitLab API"""
try:
gl = gitlab.Gitlab.from_config(gitlab_id, config_files=CONFIG_FILE)
gitlab_private_token = os.environ['GITLAB_PRIVATE_TOKEN']
except KeyError:
print("GITLAB_PRIVATE_TOKEN environment variable not set!")
sys.exit(1)
try:
gl = gitlab.Gitlab(gitlab_url, private_token=gitlab_private_token)
except (gitlab.config.GitlabIDError, gitlab.config.GitlabDataError) as e:
print("Exception in python-gitlab: {}.\n".format(e),
"Check python-gitlab configuration on",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment