getavalon/core

Apps launched with launcher don't format {AVALON_PROJECT} to the Session it launches in.

Closed this issue · 1 comments

Issue

I noticed some interesting behavior when a .toml for an application had something like:

[environment]
MY_CUSTOM_VARIABLE = {AVALON_PROJECT}

The AVALON_PROJECT value would become the value placeholder, not the actual project name that it launched in. This was due to how the applications are retrieved when going into a project, specifically in control.py it uses its lib.get_apps() that triggers avalon.lib.get_application to build the application from the .toml on disk.

And the avalon.lib.get_application() directly embeds the "current environment" into the environment variables of that application definition.

Solution

The application environment should only get injected upon launch (when it gets triggered) as opposed to when it gets loaded as it currently does. It should at the very least include the Session for the launch correctly so placeholder is not set like this but the actual project's name.

  1. My proposal would be to change: avalon.lib.get_application to only read out the toml, but not perform the environment management and leave that up to the action. We will need to read the .toml at least before "running" it to load the icon and color to be displayed in the Launcher.

Just for noting this down, the placeholder was coming from here in Launcher.