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

fix(config): avoid recursion when interpolating env #8014

Merged
merged 6 commits into from Sep 9, 2020
Merged

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Sep 3, 2020

Types of changes

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

Description

originally reported by @hartmut-co-uk in discord following config makes maximum call stack error:

  privateRuntimeConfig: {
    API_SECRET: '${API_SECRET}'
  },

It is also reproducible with dotenv-expand itself when using variable as value. Since we are using forked version there is this PR but have to also fix for upstream.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@pi0 pi0 requested a review from a team September 3, 2020 11:49
@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2020

Codecov Report

Merging #8014 into dev will decrease coverage by 0.05%.
The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #8014      +/-   ##
==========================================
- Coverage   68.87%   68.82%   -0.06%     
==========================================
  Files          91       91              
  Lines        3849     3852       +3     
  Branches     1044     1046       +2     
==========================================
  Hits         2651     2651              
- Misses        971      973       +2     
- Partials      227      228       +1     
Flag Coverage Δ
#unittests 68.82% <20.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/config/src/load.js 75.28% <20.00%> (-2.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7da6fd...1beefb0. Read the comment docs.

clarkdo
clarkdo previously approved these changes Sep 3, 2020
Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

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

What about giving a warning message here?

@pi0
Copy link
Member Author

pi0 commented Sep 3, 2020

@clarkdo Making sense. I also improved logic to early stop to avoid duplicate values:

image

@pi0 pi0 requested a review from clarkdo September 3, 2020 12:02
@pi0 pi0 changed the title fix(config): avoid recursion when interpolating fix(config): avoid recursion when interpolating dotenv Sep 9, 2020
@pi0 pi0 changed the title fix(config): avoid recursion when interpolating dotenv fix(config): avoid recursion when interpolating env Sep 9, 2020
@pi0 pi0 merged commit 4de44e6 into dev Sep 9, 2020
@pi0 pi0 deleted the fix/dotenv-recursive branch September 9, 2020 08:50
@pi0 pi0 mentioned this pull request Sep 9, 2020
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants