Skip to content

Comments

YJDH-813 | All frontends: Fix use of env vars in /frontend/next.config.js#3905

Draft
karisal-anders wants to merge 1 commit intomainfrom
YJDH-813-fix-env-setting
Draft

YJDH-813 | All frontends: Fix use of env vars in /frontend/next.config.js#3905
karisal-anders wants to merge 1 commit intomainfrom
YJDH-813-fix-env-setting

Conversation

@karisal-anders
Copy link
Collaborator

Description ✨

All frontends: Fix use of env vars in /frontend/next.config.js

TL:DR;

In /frontend/next.config.js:
1. Move env var readings inside nextConfig function
2. Handle overriding env vars gracefully
3. Remove unnecessary withPlugins / next-compose-plugins

Done:

  • Move all readings of env vars from module level to inside the nextConfig function so that the environment variables set in the applications' next.config.js files using dotenv are in use when the env vars' values are evaluated.
  • Destructure env from nextConfig's input and spread it into env key in nextConfig function's return value, so the env override is combined with the APP_NAME, APP_VERSION and BUILD_TIME settings rather than removing/overriding them directly as was the case with the override parameter before. Spread the rest of the nextConfigs input as previously.
  • Remove withPlugins and next-compose-plugins as unnecessary as the used plugins were always empty. The next-compose-plugins package was last published on npm 5 years ago, so all the more reason to get rid of it.

refs YJDH-813

Issues 🐛

Testing ⚗️

Screenshots 📸

Additional notes 🗒️

TL:DR;
```
In /frontend/next.config.js:
1. Move env var readings inside nextConfig function
2. Handle overriding env vars gracefully
3. Remove unnecessary withPlugins / next-compose-plugins
```

Done:
- Move all readings of env vars from module level to inside the
  nextConfig function so that the environment variables set in the
  applications' next.config.js files using dotenv are in use when the
  env vars' values are evaluated.
- Destructure `env` from nextConfig's input and spread it into `env` key
  in nextConfig function's return value, so the `env` override is
  combined with the APP_NAME, APP_VERSION and BUILD_TIME settings rather
  than removing/overriding them directly as was the case with the
  `override` parameter before. Spread the rest of the nextConfigs input
  as previously.
- Remove withPlugins and next-compose-plugins as unnecessary as the used
  plugins were always empty. The next-compose-plugins package was last
  published on npm 5 years ago, so all the more reason to get rid of it.

refs YJDH-813
@azure-pipelines
Copy link

YJDH-KESASETELI-API branch is deployed to platta: https://yjdh-kesaseteli-pr3905.api.dev.hel.ninja 🚀🚀🚀

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

@azure-pipelines
Copy link

YJDH-HELSINKILISA-API branch is deployed to platta: https://helsinkilisa-pr3905.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://kesaseteli-handler-ui-pr3905.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

YOUTH branch is deployed to platta: https://nuortenkesaseteli-pr3905.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://helsinkilisa-ui-handler-pr3905.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

EMPLOYER branch is deployed to platta: https://kesaseteli-pr3905.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-handler-ui-pr3905.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://nuortenkesaseteli-pr3905.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-pr3905.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

APPLICANT is deployed to platta: https://helsinkilisa-ui-pr3905.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-handler-pr3905.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-pr3905.dev.hel.ninja 😆🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant