Skip to content

Commit

Permalink
Merge branch 'issue_1097-disable-home-rezconfig'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Jun 16, 2021
2 parents b173079 + 00978b0 commit 1c97a43
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,9 @@ def _create_main_config(cls, overrides=None):
if filepath:
filepaths.extend(filepath.split(os.pathsep))

filepath = os.path.expanduser("~/.rezconfig")
filepaths.append(filepath)
if os.getenv("REZ_DISABLE_HOME_CONFIG", "").lower() not in ("1", "t", "true"):
filepath = os.path.expanduser("~/.rezconfig")
filepaths.append(filepath)

return Config(filepaths, overrides)

Expand Down
3 changes: 2 additions & 1 deletion src/rez/rezconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
2) The setting is then overridden if it is present in another settings file(s)
pointed at by the $REZ_CONFIG_FILE environment variable. Note that multiple
files are supported, separated by os.pathsep;
3) The setting is further overriden if it is present in $HOME/.rezconfig;
3) The setting is further overriden if it is present in $HOME/.rezconfig,
UNLESS $REZ_DISABLE_HOME_CONFIG is 1;
4) The setting is overridden again if the environment variable $REZ_XXX is
present, where XXX is the uppercase version of the setting key. For example,
"image_viewer" will be overriden by $REZ_IMAGE_VIEWER. List values can be
Expand Down
4 changes: 4 additions & 0 deletions src/rez/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ def test_8(self):
if not key.startswith("REZ_")
}

env.update({
"REZ_DISABLE_HOME_CONFIG": "1"
})

test_configs = {
"packages_path": ["/foo bar/baz", "/foo bar/baz hey", "/home/foo bar/baz"],
"platform_map": {"foo": {"bar": "baz"}},
Expand Down
2 changes: 2 additions & 0 deletions wiki/pages/Environment-Variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ operation of rez.
* **REZ_(CONFIG_ENTRY)_JSON** - Same as the previous env-var, except that the format
is a JSON string. This means that some more complex settings can be overridden,
that aren't supported in the non-JSON case (*package_filter* is an example).
* **REZ_DISABLE_HOME_CONFIG** - If 1/t/true, The default `~/.rezconfig.py` config
file is skipped.
* **EDITOR** - On Linux and OSX systems, this will set the default editor to use
if and when rez requires one (an example is on release if the *prompt_release_message*
config setting is true).
Expand Down

0 comments on commit 1c97a43

Please sign in to comment.