Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[templates] Introduce layout service REST configuration name environment variable #1543

Merged
merged 12 commits into from
Jul 6, 2023

Conversation

illiakovalenko
Copy link
Contributor

@illiakovalenko illiakovalenko commented Jun 29, 2023

Description / Motivation

Testing Details

  • Unit Test Added
  • Manual Test/Other - ran all the frameworks in connected mode and checked that custom layout service configuration name provided via environment variable is applied, verified mergeEnv functionality

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, looks great (just a couple comments). But looking through this, I wonder if we should make this a purely JSS config-based solution (and lose the .env values). The original PR depended on the .env values to supply the default value, but in this PR we have the fallback/default provided by the JSS config logic.

For nextjs-sxa, this would mean instead of a .env we could use a config plugin (e.g. /scripts/config/plugins/sxa.ts).

Considerations for removing the .env value:

  • Environment variables should be something that would change per environment or deployment (yes, we have at least one offender of this rule already :)). I can't imagine a case where this one would.
  • Not introducing another .env value (reducing the amount we already have is an internal goal)
  • The nice thing about our JSS config architecture is that an environment variable can be used if absolutely necessary

If we do decide to go this route (and remove the .env vals), I think the .env concat > merge logic is a great improvement and should stay either way.

@illiakovalenko
Copy link
Contributor Author

In general, looks great (just a couple comments). But looking through this, I wonder if we should make this a purely JSS config-based solution (and lose the .env values). The original PR depended on the .env values to supply the default value, but in this PR we have the fallback/default provided by the JSS config logic.

For nextjs-sxa, this would mean instead of a .env we could use a config plugin (e.g. /scripts/config/plugins/sxa.ts).

Considerations for removing the .env value:

  • Environment variables should be something that would change per environment or deployment (yes, we have at least one offender of this rule already :)). I can't imagine a case where this one would.
  • Not introducing another .env value (reducing the amount we already have is an internal goal)
  • The nice thing about our JSS config architecture is that an environment variable can be used if absolutely necessary

If we do decide to go this route (and remove the .env vals), I think the .env concat > merge logic is a great improvement and should stay either way.

It's a great proposal! Right, for the future we can introduce more config based variables if we will need it (env vars not required to be added)
So, for nextjs, react I'm using config based variable, for the rest of frameworks I also decided to remove env variable even though we don't have plugins yet, but I think it's still fine

@illiakovalenko illiakovalenko requested a review from ambrauer July 3, 2023 08:40
Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ambrauer ambrauer merged commit 2c76f9c into dev Jul 6, 2023
@ambrauer ambrauer deleted the bugfix/578343 branch July 6, 2023 13:04
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.

3 participants