Environment variables in MFEs

This is probably related to the same issue I recently had with Order History in the frontend-app-ecommerce.

In this case, I am trying to setup the INFO_EMAIL variable for the GitHub - openedx/frontend-app-authn: Open edX micro-frontend application for new login and registration experience. and I cannot find how to do it properly.

Using a plugin and trying to setup
MFE_CONFIG[“INFO_EMAIL”] = “support@edulib.org
doesn’t work for me.

I cannot determine which patch to use in my plugin or how to specify it exclusively for the authn MFE.

Any suggestions?

P.S. I would like not to have to fork the repo in order to force the variable in the .env file. That’s what I had to do for the Order History in frontend-app-ecommerce.

I am going to use a graphical example based on the Tutor demo site

On the right side, underneath the “Envoyez” button, you can see “For additional help, contact Open edX Demo Site support at”. In the code of the frontend-app-authn it refers to the INFO_EMAIL environment variable. You can see that even on the Demo Site, it is not set up properly.

@regis @arbrandes how would you setup that variable so that it can be used by MFE_CONFIG ?

I’ve tried adding it with a plugin through mfe-lms-development-setting, mfe-lms-production-settings and openedx-lms-production-settings without any success. The only thing that works for me thus far is forking the MFE and forcing the values in the .env file of the repo. Is there a better solution without forking the MFE? Inquiring minds want to know…

A patch to mfe-lms-production-settings should have worked, from what I can tell by looking at the code. (getConfig() is being called as it should.) Are you sure this wasn’t just the config cache taking a while to refresh?

Did you also try site_configuration, by any chance?

1 Like

Possible. As I am working on a test server right now, I can try a few things.

Something I found bizarre is in GitHub - openedx/frontend-app-authn: Open edX micro-frontend application for new login and registration experience. I discovered that MFE_CONFIG_API_URL is supposed to be setup as /api/v1/mfe_config

But when I try to set it myself I then discovered
ubuntu@ip-10-0-0-48:~/.local/share/tutor/env$ grep -r MFE_CONFIG_API_URL

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

plugins/mfe/build/mfe/Dockerfile:ENV MFE_CONFIG_API_URL=/api/mfe_config/v1

apps/openedx/settings/lms/production.py:MFE_CONFIG[“MFE_CONFIG_API_URL”] = “/api/v1/mfe_config”

apps/openedx/settings/lms/production.py:MFE_CONFIG[“MFE_CONFIG_API_URL”] = “/api/v1/mfe_config”

apps/openedx/settings/lms/development.py:MFE_CONFIG[“MFE_CONFIG_API_URL”] = “/api/v1/mfe_config”

so, is it /api/mfe_config/v1 or /api/v1/mfe_config ?

I haven’t tried through site_configuration. I will try it.

The tutor-mfe proxy expects it to be /api/mfe_config/v1, as per the Dockerfile template and the CaddyFile. It is also the URL set in the LMS. So this is what should be set on the MFEs.

Thanks. That makes the documentation for MFE_CONFIG_API_URL in frontend-app-authn#environment-variablessetup-notes to be wrong then.

Yup, definitely wrong!

@arbrandes might have been right about the config cache taking a while to refresh.

I also added
INFO_EMAIL: support@edulib.org
to config,yml just to be sure.

I saved the configuration. I did a fresh rebuild of my images after stopping Tutor completely. The value of INFO_EMAIL suddenly appeared.

Thanks @arbrandes

1 Like

A fix by @misilot is in progress in the MFE plugin: Add INFO_EMAIL and PASSWORD_RESET_SUPPORT_LINK by misilot · Pull Request #141 · overhangio/tutor-mfe · GitHub

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.