From 92a893b8e230718436582dcad96175685425b1df Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 12 Dec 2021 19:19:45 +0100 Subject: feat(cli): do not require config file to run CLI BREAKING CHANGE: A config file is no longer needed to run the CLI. python-gitlab will default to https://gitlab.com with no authentication if there is no config file provided. python-gitlab will now also only look for configuration in the provided PYTHON_GITLAB_CFG path, instead of merging it with user- and system-wide config files. If the environment variable is defined and the file cannot be opened, python-gitlab will now explicitly fail. --- docs/cli-usage.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/cli-usage.rst b/docs/cli-usage.rst index ea10f93..50fac6d 100644 --- a/docs/cli-usage.rst +++ b/docs/cli-usage.rst @@ -4,7 +4,8 @@ ``python-gitlab`` provides a :command:`gitlab` command-line tool to interact with GitLab servers. It uses a configuration file to define how to connect to -the servers. +the servers. Without a configuration file, ``gitlab`` will default to +https://gitlab.com and unauthenticated requests. .. _cli_configuration: @@ -16,8 +17,8 @@ Files ``gitlab`` looks up 3 configuration files by default: -``PYTHON_GITLAB_CFG`` environment variable - An environment variable that contains the path to a configuration file +The ``PYTHON_GITLAB_CFG`` environment variable + An environment variable that contains the path to a configuration file. ``/etc/python-gitlab.cfg`` System-wide configuration file @@ -27,6 +28,13 @@ Files You can use a different configuration file with the ``--config-file`` option. +.. warning:: + If the ``PYTHON_GITLAB_CFG`` environment variable is defined and the target + file exists, it will be the only configuration file parsed by ``gitlab``. + + If the environment variable is defined and the target file cannot be accessed, + ``gitlab`` will fail explicitly. + Content ------- -- cgit v1.2.1