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: use public versions of wp env vars #253

Merged
merged 2 commits into from
Feb 18, 2023
Merged

fix: use public versions of wp env vars #253

merged 2 commits into from
Feb 18, 2023

Conversation

ccorda
Copy link
Contributor

@ccorda ccorda commented Feb 9, 2023

Using NEXT_PUBLIC prefixed urls to fix preview mode. closes #245

Copied over the constants logic to next.config.js, so our wp-content/uploads rewrite rule works on both http and https domains. closes #249

@vercel
Copy link

vercel bot commented Feb 9, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated
bubs-next ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2023 at 2:05PM (UTC)

@ccorda ccorda marked this pull request as draft February 9, 2023 18:24
@ccorda ccorda marked this pull request as ready for review February 9, 2023 22:22
@ccorda
Copy link
Contributor Author

ccorda commented Feb 9, 2023

Because we're using ||, we need to convert variables on sites, not duplicate.

@ccorda ccorda requested a review from chrisherold February 9, 2023 22:23
@ccorda ccorda requested a review from kylehotchkiss February 17, 2023 23:34
@@ -45,6 +45,6 @@ By default, we tend to configure preview branches to use production graphql, so

Sometimes we want a staging WordPress where we can test changes there.

Vercel supports per branch env variables, which allows us to setup a combination of WP backend and Next front-end for a specific branch. You'll want to set the `WORDPRESS_DOMAIN` and `WORDPRESS_API_URL` variables to point to your staging WordPress. The `HEADLESS_AUTH_SECRET` and `HEADLESS_API_SECRET` can be the same values on both production and staging.
Vercel supports per branch env variables, which allows us to setup a combination of WP backend and Next front-end for a specific branch. We typically have preview instances point to production WP by default so that front-end only branches will work. When you need to point to a different WordPress endpoing, you can update the the `NEXT_PUBLIC_WORDPRESS_DOMAIN` and `NEXT_PUBLIC_WORDPRESS_API_URL` ENV variables. The `HEADLESS_AUTH_SECRET` and `HEADLESS_API_SECRET` can be the same values on both production and staging.
Copy link
Member

Choose a reason for hiding this comment

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

Glad to see this documented as convention, and I'll adjust any projects I'm working on where I see the setup is different.

@ccorda ccorda changed the title use public versions of wp env vars refactor: use public versions of wp env vars Feb 18, 2023
@ccorda ccorda changed the title refactor: use public versions of wp env vars fix: use public versions of wp env vars Feb 18, 2023
@ccorda ccorda merged commit 728b95d into main Feb 18, 2023
@ccorda ccorda deleted the 245-public-env branch February 18, 2023 00:37
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.

Local dev uploads rewrite issue Preview Mode losing the WORDPRESS_URL constant
2 participants