Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $DOHQ_ARTIFACTORY_PYTHON_CFG environment variable #413

Merged
merged 2 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1409,10 +1409,10 @@ path = ArtifactoryPath(

## Global Configuration File ##

Artifactory Python module also can specify all connection-related settings in a central file,
```~/.artifactory_python.cfg``` that is read upon the creation of first ```ArtifactoryPath``` object and is stored
globally. For instance, you can specify per-instance settings of authentication tokens, so that you won't need to
explicitly pass ```auth``` parameter to ```ArtifactoryPath```.
Artifactory Python module also can specify all connection-related settings in a central file, given by environment
variable ```$DOHQ_ARTIFACTORY_PYTHON_CFG``` (default if not set: ```~/.artifactory_python.cfg```) that is read upon
the creation of first ```ArtifactoryPath``` object and is stored globally. For instance, you can specify per-instance
settings of authentication tokens, so that you won't need to explicitly pass ```auth``` parameter to ```ArtifactoryPath```.

Example:

Expand Down
7 changes: 5 additions & 2 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@
except ImportError:
import ConfigParser as configparser

default_config_path = "~/.artifactory_python.cfg"
if platform.system() == "Windows":
if "DOHQ_ARTIFACTORY_PYTHON_CFG" in os.environ:
default_config_path = os.environ["DOHQ_ARTIFACTORY_PYTHON_CFG"]
elif platform.system() == "Windows":
default_config_path = "~\\.artifactory_python.cfg"
else:
default_config_path = "~/.artifactory_python.cfg"
global_config = None


Expand Down