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: escape env variables #62

Merged
merged 1 commit into from
Nov 17, 2022
Merged

fix: escape env variables #62

merged 1 commit into from
Nov 17, 2022

Conversation

regisb
Copy link
Contributor

@regisb regisb commented Oct 3, 2022

With this change, we avoid the problem of having to escape env variables altogether. Previously, env variables were loaded both by bash (in development) and docker-compose (in production). This meant that we had to deal with escaping in both contexts, which was the source of trouble. We resolve this by loading env vars only with bash.

Close #61.

@regisb regisb changed the title DRAFT fix: escape env variables draft: fix: escape env variables Oct 3, 2022
@regisb regisb marked this pull request as draft October 3, 2022 18:57
@regisb regisb changed the title draft: fix: escape env variables fix: escape env variables Oct 3, 2022
@regisb
Copy link
Contributor Author

regisb commented Oct 3, 2022

I opened this draft PR as a resolution of the issue discussed here: #61 (comment) We still need to decide whether this is the best possible solution.

@ghassanmas ghassanmas mentioned this pull request Oct 17, 2022
@regisb regisb marked this pull request as ready for review October 17, 2022 14:35
@regisb regisb requested a review from arbrandes October 17, 2022 14:35
@regisb regisb force-pushed the regisb/fix-env-escaping branch 2 times, most recently from 03ba1be to 8b17339 Compare November 15, 2022 11:57
With this change, we avoid the problem of having to escape env variables
altogether. Previously, env variables were loaded both by bash (in development)
and docker-compose (in production). This meant that we had to deal with
escaping in both contexts, which was the source of trouble. We resolve this by
loading env vars only with bash.

Close #61.
@regisb regisb force-pushed the regisb/fix-env-escaping branch from 8b17339 to f3fc90d Compare November 15, 2022 12:39
@regisb
Copy link
Contributor Author

regisb commented Nov 15, 2022

The rebased and updated PR works with tutor local quickstart and tutor dev quickstart. Should totally mean that it works everywhere, right?
In all seriousness, there are quite a few changes here but I'm fairly confident that they work as expected. I think that they greatly simplify how MFE settings work.

Copy link
Collaborator

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Works for me! I made a comment out of curiosity, but I don't expect we need to change anything because of it.

CMD ["/bin/bash", "-c", "set -a && \
source /openedx/env/production && \
source /openedx/env/development && \
npm run start --- --config ./webpack.dev-tutor.config.js"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need the three dashes here? I can't for the life of me find official documentation on why that's necessary in CMD in the first place, but I thought it was just because it was a separate item in the array. (I could totally be wrong, though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 this change was introduced a couple days ago by @ARMBouhali: https://github.com/overhangio/tutor-mfe/pull/74/files#r1015250142 In my understanding, it's necessary because it's the only way to use the webpack dev config.

Is there an alternative solution?

Copy link
Collaborator

Choose a reason for hiding this comment

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

At the very least, @ARMBouhali, can you point us to how/where you figured this one out?

@regisb regisb merged commit 9b1b08f into master Nov 17, 2022
@regisb regisb deleted the regisb/fix-env-escaping branch November 17, 2022 09:48
@ARMBouhali
Copy link
Contributor

ARMBouhali commented Nov 17, 2022

@arbrandes already mentioned, it's just a little deeper

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.

Site name that contains empty spaces is incorrectly displayed in browser tab
3 participants