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

chore: Use local api for self hosted snippets #4807

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kyle-ssg
Copy link
Member

@kyle-ssg kyle-ssg commented Nov 5, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Uses admin api for SDK snippets instead of flagsmith on flagsmith url. Closes #4130

How did you test this code?

Viewed code snippets in all languages

@kyle-ssg kyle-ssg requested a review from a team as a code owner November 5, 2024 16:27
Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 8:06pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 8:06pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 8:06pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard chore labels Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-4807 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-4807 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-4807 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4807 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-4807 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4807 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Nov 5, 2024

Uffizzi Ephemeral Environment deployment-57972

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/4807

📄 View Application Logs etc.

What is Uffizzi? Learn more!

matthewelwell
matthewelwell previously approved these changes Nov 6, 2024
@matthewelwell matthewelwell dismissed their stale review November 6, 2024 12:09

Testing via preview link seems to show an issue.

@matthewelwell
Copy link
Contributor

matthewelwell commented Nov 6, 2024

I'm not sure if this is a symptom of using the preview URL, but it's showing the API URL being overridden here which I Don't think is correct?

image

@github-actions github-actions bot added chore and removed chore labels Nov 19, 2024
@github-actions github-actions bot added chore and removed chore labels Nov 19, 2024
@github-actions github-actions bot added chore and removed chore labels Nov 19, 2024
@github-actions github-actions bot added chore and removed chore labels Nov 19, 2024
frontend/common/constants.ts Dismissed Show dismissed Hide dismissed
@kyle-ssg
Copy link
Member Author

This should be resolved now the api url for the sdk docs will adhere to the following

  • If using saas or the frontend is configured to point to our production api it'll use the edge api
  • Otherwise use wherever the frontend is hitting for admin endpoints
 getFlagsmithSDKUrl: () =>
    Utils.isSaas() || Project.api.startsWith('https://api.flagsmith.com')
Dismissed
      ? Project.flagsmithClientEdgeAPI
      : Project.api,

@matthewelwell
Copy link
Contributor

Sorry, I think it also doesn't work very well in the unified image?

Screenshot 2024-11-27 at 11 21 42

Comment on lines +445 to +447
Utils.isSaas() || Project.api.startsWith('https://api.flagsmith.com')
? Project.flagsmithClientEdgeAPI
: Project.api,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really know what the solution is here, but we need to account for when Project.api is just /api/v1 as per the above screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All code examples should be instance-aware
2 participants