Skip to content

Commit

Permalink
Add DOHQ_ARTIFACTORY_PYTHON_CFG env variable (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorenar authored Jun 22, 2023
1 parent 1e5b6f2 commit 47d477e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit 47d477e

Please sign in to comment.