Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Local overrides for environment variables #3045

Merged

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Apr 8, 2022

Brief description

Give ability to define white list of environment variables that can be changed per machine.

Description

In system_settings/general was added new key local_env_white_list where is possible to define environment variable keys that can be changed per machine. Values of the environment variable keys can be set in Local settings UI. Values are applied on application launch and only if launch environments contain the keys.

Additional info

These environment variable changes are not applied on OpenPype launch but only on application launch.

Questions

  1. Not sure about the placement of the env white list in the system_settings/general/local_env_white_list, it could be maybe added under applications as it's related to them?

Documentation

TODO modify documentation based on answer of question 1

Testing notes:

  1. Add a env key into system_settings/general/local_env_white_list (e.g. "TEST")
  2. Choose one application (ideally DCC with script editor) and and env settings add the env key with some value (e.g. "TEST": "OriginValue")
  3. Open local settings and set value of the key to somethig different (e.g. "MyValue")
  4. Launch the application and check the value

For more complex test also add tool and use the environment key in other key as value.
5. Choose one tool and add there different key using the key from step 1 (e.g.: "SUBKEY_TEST": "This is {TEST}") 6. Make sure the tool is added to asset on which you're testing 7. Launch the application and check value of the key from step 5 ("SUBKEY_TEST"should have"MyValue"`)

When key is removed from system_settings/general/local_env_white_list it should not be overriden even if is still available in local settings.

Screenshots

image
image
image

@ynbot
Copy link
Contributor

ynbot commented Apr 8, 2022

@iLLiCiTiT iLLiCiTiT self-assigned this Apr 8, 2022
@iLLiCiTiT iLLiCiTiT added the type: feature Larger, user affecting changes and completely new things label Apr 8, 2022
@mkolar
Copy link
Member

mkolar commented Apr 10, 2022

Will this require new binaries?

@iLLiCiTiT
Copy link
Member Author

Will this require new binaries?

Nope

Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me perfectly. I would leave the whitelist where it is as you can use it even for global variables, not only application specific - for example overriding some variable storing your license server or whatever.

@iLLiCiTiT
Copy link
Member Author

I would leave the whitelist where it is as you can use it even for global variables

That's the issue. You can't use it for general variables now.

@mkolar
Copy link
Member

mkolar commented Apr 11, 2022

That's the issue. You can't use it for general variables now.

Yeah we've had that conversation in the office a few times now. Not sure where is the reasonable line to draw here. I was also suggesting ability to override any variable, albeit, that can be totally deadly to OP

@iLLiCiTiT
Copy link
Member Author

I've added ability to change general environments too, only condition is that the key must be available in settings of general environments (Still not require new binaries).

@iLLiCiTiT iLLiCiTiT merged commit e291819 into develop Apr 11, 2022
@iLLiCiTiT iLLiCiTiT deleted the feature/OP-3048_Local-overrides-for-environment-variables branch April 11, 2022 18:36
@pberto
Copy link
Contributor

pberto commented Apr 28, 2022

@iLLiCiTiT good one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Larger, user affecting changes and completely new things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants