-
Notifications
You must be signed in to change notification settings - Fork 232
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
Allow users specify the user-specific config via an environmental variable #1361
Comments
??? |
So I have the main configuration files (e.g. centos7) under Now, if I want to tweak something without changing that system wide config, I could override a config opt by putting my them into If the above is how it works, then I would like to instruct mock to look into an additional place for the overrides - via an environment variable perhaps. Let me know if this makes sense or not |
Here's what I'm proposing: diff --git a/mock/py/mockbuild/config.py b/mock/py/mockbuild/config.py
index 2178c5b7..0f8116f0 100644
--- a/mock/py/mockbuild/config.py
+++ b/mock/py/mockbuild/config.py
@@ -891,6 +891,9 @@ def load_config(config_path, name):
cfg = os.path.join(os.path.expanduser(
'~' + pwd.getpwuid(os.getuid())[0]), '.config/mock.cfg')
do_update_config(log, config_opts, cfg, name)
+ cfg = os.environ.get("MOCK_CFG_PATH", None)
+ if cfg:
+ do_update_config(log, config_opts, cfg, name) |
I understand what you are trying to achieve. But I think this add unnecessary complexity to Mock. You can achieve the same by
or
The last one does exactly what you are trying to achieve. Right? |
Or, can you use something like this wrapper?
|
Ah yeah this could work indeed. The problem include directive is crucial here. I can go with this and post here in case there’s some unexpected complication. Thank you!! |
i am closing this for now. |
Ability to specify location of the user mock.cfg with an environmental variable
I would like to be able to specify an additional location for the user-based mock.cfg file based on an environmental variable. Currently these locations are:
The reason is that I have tens of projects with different customizations and unless it's done it's difficult to manage.
The text was updated successfully, but these errors were encountered: