Skip to content
Snippets Groups Projects
Commit 01fa869b authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[init] Minimize impact of (global, silent) environment variables being set

parent 9df9da0e
No related branches found
No related tags found
No related merge requests found
Pipeline #26062 passed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Environment variable initialization'''
import os
from .constants import CACERT
from .bootstrap import set_environment
# must set LANG and LC_ALL before using click
set_environment('LANG', 'en_US.UTF-8', os.environ)
set_environment('LC_ALL', os.environ['LANG'], os.environ)
# we need the right certificates setup as well
set_environment('SSL_CERT_FILE', CACERT, os.environ)
set_environment('REQUESTS_CA_BUNDLE', CACERT, os.environ)
...@@ -48,9 +48,22 @@ def raise_on_error(view_func): ...@@ -48,9 +48,22 @@ def raise_on_error(view_func):
return wraps(view_func)(_decorator) return wraps(view_func)(_decorator)
# warning: must set LANG and LC_ALL before using click
# see: https://click.palletsprojects.com/en/7.x/python3/
if 'LANG' not in os.environ:
os.environ['LANG'] = 'en_US.UTF-8'
if 'LC_ALL' not in os.environ:
os.environ['LC_ALL'] = 'en_US.UTF-8'
@with_plugins(pkg_resources.iter_entry_points('bdt.cli')) @with_plugins(pkg_resources.iter_entry_points('bdt.cli'))
@click.group(cls=AliasedGroup, @click.group(cls=AliasedGroup,
context_settings=dict(help_option_names=['-?', '-h', '--help'])) context_settings=dict(help_option_names=['-?', '-h', '--help']))
def main(): def main():
"""Bob Development Tools - see available commands below""" """Bob Development Tools - see available commands below"""
pass
from ..constants import CACERT
from ..bootstrap import set_environment
# certificate setup: required for gitlab API interaction
set_environment('SSL_CERT_FILE', CACERT, os.environ)
set_environment('REQUESTS_CA_BUNDLE', CACERT, os.environ)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment