nuxt-oidc-auth icon indicating copy to clipboard operation
nuxt-oidc-auth copied to clipboard

Cannot use dev mode with Playwright against production container

Open Damien-VS opened this issue 6 months ago • 0 comments

Could be associated with #26 , underlying problem is not the same.

We use container promotion and environment variable injection. Our process looks like this :

  1. build app
  2. containerize
  3. inject TEST .env properties in container & test with playwright
  4. promote to dev -> inject DEV .env properties and run in the DEV cloud
  5. promote to prod -> inject PROD .env properties and run in the PROD cloud

Needs:

  • Be able to choose between OIDC / mock in local, test and DEV cloud environment
  • Be able to set "NODE_ENV" to whatever value we need and still respect the point above
  • Be able to switch OIDC/mock at cold start / runtime (not build time)
  • Not have code suggesting an unexpected behavior (eg: "devMode.enabled: true" on prod environment with devMode disabled)

Problems:

  • nuxt.config.ts is executed at build time, and valid for all environment. Hence the flag "oidc.devMode.enabled=true" will be present everywhere (bad readability)
  • process.env.NODE_ENV has to be "TEST" for some plugins, "E2E" for others and "development" for this plugin (bad reuse of not-owned property)

Proposed solution:

  • Get rid of the "oidc.devMode.enabled=true" that MAY NOT activate devMode

  • activate devMode on an owned env property. eg : "process.env.NUXT_OIDC_DEVMODE=true" or "process.env.NUXT_OIDC_MODE=mock"

  • stop mixing "dev" with "mock" as the two concepts are differents, albeit often used together. this is confusing on edge cases

  • BONUS : export DevModeConfig type to be imported in out nuxt.config.ts

Damien-VS avatar Aug 06 '24 14:08 Damien-VS