How to add env patch to a mfe in Palm

Hi guys! How can we add a .env variable that doesn’t exits or re write one to an mfe since tutor which means for example I want to add this variable

MY_CUSTOM_VARIABLE=true

I’ve tried to do it as the doc but didn’t work for me I did something like below

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_items(
    [
        (
            "mfe-lms-development-settings",
            """          
MFE_CONFIG["MY_CUSTOM_VARIABLE"] = True

"""
        ),
        
        (
            "mfe-lms-production-settings",
            """           
MFE_CONFIG["MY_CUSTOM_VARIABLE"] = True

"""
        )
        
        
    ]
)

Any help will really appreciate, thanks!

Your plugin should work.

Can you describe more precisely what failed?

Hi @regis!
When I go inside a Docker container of a any mfe the variable is not in .env files that is the problem

As of Palm and runtime configuration, microfrontends no longer use environment variables for configuration. Instead, configuration is pulled from the LMS at runtime. This makes it possible to build MFE images once and for all users.

@regis I beg to differ.

I encountered a similar problem here

The only way I was able to pass the proper values to the frontend-app-ecommerce MFE was to set these values in a fork and in the .env file for that MFE.

OK then let’s just say in most cases environment variables will be ignored :sweat_smile:

1 Like