awslabs / aws-saas-boost

AWS SaaS Boost is a ready-to-use toolset that removes the complexity of successfully running SaaS workloads in the AWS cloud.
Apache License 2.0
954 stars 188 forks source link

Environment Variables in .env File Not Taking Effect After Uploading via Onboarding ZIP #528

Open EsamHussein opened 10 months ago

EsamHussein commented 10 months ago

Description of the bug:

After onboarding an application using a ZIP file that contains a .env file, the environment variables defined within the .env file don't seem to have any effect on the application.


Reproduction Steps:

  1. Prepare an application with a .env file containing specific environment variables.
  2. ZIP the application and its related files.
  3. Use the onboarding feature in AWS SaaS Boost to upload the ZIP file.
  4. Launch the application and verify if the environment variables from the .env file are in effect.

What did you expect to happen?

I expected that after onboarding the application using the ZIP file, the environment variables defined in the .env file would be set and in effect when the application runs.


What actually happened?

The environment variables defined within the .env file were not recognized or applied to the application after onboarding.


Environment:

tomg-formpak commented 9 months ago

@EsamHussein Hi, just out of curiosity, Is the bug you mentioned related to the feature - https://github.com/awslabs/aws-saas-boost/discussions/465 ?

If possible, I would appreciate it if we could have a discussion about this so that the team can work towards a solution.

Thank you

brtrvn commented 9 months ago

@EsamHussein this is a misunderstanding of what the "config" file is for. It does not effect the system environment of the SaaS application, it is simply a mechanism to provide arbitrary data per-tenant to the underlying SaaS application. What that SaaS application does with the information contained in the "config" archive is up to the application.

As Tom mentions above, we do have a feature request for altering the system's execution environment with arbitrary key/values, but this is not in place today.

If you're leveraging an application framework such as the Spring Framework, you may be able to alter the environment at runtime after the container has launched. Other application frameworks may have similar features.

Here's one such example of downloading the "config" ZIP file during your application's initialization, and applying the contents of a *.properties file to the application's environment. https://github.com/brtrvn/saas-boost-examples