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

Removes URLs from environment variables #362

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

simonbs
Copy link
Contributor

@simonbs simonbs commented Sep 12, 2024

This PR removes NEXTAUTH_URL_INTERNAL, previously needed to workaround a bug in the Auth.js 5.0 beta, which is no longer necessary.

It also removes FRAMNA_DOCS_BASE_URL, used for constructing preview links in PR comments. We now dynamically extract the host from the URL that triggered the webhook, eliminating hardcoded URLs.

This removes all hard-coded URLs, making it simpler to deploy Shape Docs and access it from different domains.

Copy link

⚠️ It looks like .env.example has changed. Remember to update the Setting Environment Variables article accordingly.

@simonbs simonbs changed the title Enhancement/removes hardcoded urls Removes URLs from environment variables Sep 12, 2024
@ulrikandersen
Copy link
Contributor

It also removes FRAMNA_DOCS_BASE_URL, used for constructing preview links in PR comments. We now dynamically extract the host from the URL that triggered the webhook, eliminating hardcoded URLs.

That's really nice 🙌

One small concern for me is that since we have only a single instance of GitHubHookHandler the hostURL is persisted across requests and will change if/when a webhook request has a different source host. You have probably already considered this, and we will probably be just fine with this behaviour. Just wanted to raise it.

@simonbs
Copy link
Contributor Author

simonbs commented Sep 13, 2024

One small concern for me is that since we have only a single instance of GitHubHookHandler the hostURL is persisted across requests and will change if/when a webhook request has a different source host.

“I considered this, but I’m struggling to determine if it’s actually an issue.

The webhook URL is configured in the GitHub app and is always a single URL. Therefore, the host we store will be consistent. However, even if the URL host changes between invocations, wouldn’t we want to capture that change? This way, we store the host for each invocation and use it a few milliseconds later.

There could be a race condition here, but I’m not sure how likely it is to occur in practice or what the best solution would be.

@ulrikandersen
Copy link
Contributor

The webhook URL is configured in the GitHub app and is always a single URL. Therefore, the host we store will be consistent. However, even if the URL host changes between invocations, wouldn’t we want to capture that change? This way, we store the host for each invocation and use it a few milliseconds later.

There could be a race condition here, but I’m not sure how likely it is to occur in practice or what the best solution would be.

Sounds like you've already considered this case. Thanks for the answer 🙏

I am comfortable with merging this. I don't think the modification of the hostURL will become a problem in practise.

@simonbs simonbs merged commit c703b93 into develop Sep 13, 2024
6 checks passed
@simonbs simonbs deleted the enhancement/removes-hardcoded-urls branch September 13, 2024 09:38
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.

2 participants