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

refactor: stellate changes from testing #309

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/src/components/Meta.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import GlobalsContext from 'contexts/GlobalsContext';
import { trimTrailingSlash } from 'lib/utils';
import { NextSeo } from 'next-seo';
import Head from 'next/head';
import { NextSeo } from 'next-seo';
import { useContext } from 'react';

export default function Meta({ title, description, image, seo }) {
Expand Down
2 changes: 2 additions & 0 deletions website/src/pages/api/revalidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export default async function handler(req, res) {
}

if (!paths || paths.length === 0) {
// eslint-disable-next-line no-console
console.log('No paths provided for revalidation');
return void res.json({ revalidated: false });
}

try {
await Promise.all(paths.map((path) => res.revalidate(path)));
// eslint-disable-next-line no-console
console.log('Paths successfully revalidated:', paths);
return void res.json({ revalidated: true });
} catch (err) {
Expand Down
3 changes: 3 additions & 0 deletions wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
restart: 'no'

environment:
PORT: ${PORT:-3000}
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: somewordpress
Expand All @@ -32,6 +33,8 @@ services:
define('HEADLESS_REVALIDATE_SECRET', 'bubs-next-vercel-revalidate-secret-key');
define('HEADLESS_AUTH_SECRET', 'bubs-next-wp-auth-secret-key');
define('HEADLESS_API_SECRET', 'bubs-next-headless-secret-key');
define('WP_STELLATE_ENABLED', false);
define('WP_STELLATE_CONFIG', 'staging');
define('WP_LOCAL_DEV', true);
define('WP_THEME', 'timber');
define('WP_DEBUG_LOG', true );
Expand Down
15 changes: 10 additions & 5 deletions wordpress/wp-content/themes/headless/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,34 @@

// Customize these variables per site
$staging_wp_host = 'bubsnexts.wpengine.com';
$development_wp_host = 'bubsnextd.wpengine.com';
$dashboard_cleanup = false; // Optionally will hide all but our custom widget
$docs_link = ''; // set to a path if you have a site/document for editor instructions

// stellate config
$stellate_logging_enabled = false; // for debugging
$stellate_production_enabled = true;
$stellate_staging_enabled = false;
$stellate_staging_service_name = "";
$stellate_staging_token = "";
$stellate_staging_purging_token = "";
$stellate_development_enabled = false;
$stellate_development_service_name = "";
$stellate_development_token = "";
$stellate_development_purging_token = "";
$stellate_purge_redirection = true;
$stellate_purge_acf_options = true;

// Determine the hosting environment we're in
if (defined('WP_ENV') && WP_ENV == 'development') {
define('WP_HOST', 'localhost');
$headless_domain = 'http://localhost:3000';
} else {
} elseif (function_exists('is_wpe')) {
$headless_domain = rtrim(get_theme_mod('headless_preview_url'), '/');

if (strpos($_SERVER['HTTP_HOST'], $staging_wp_host) !== false) {
define('WP_HOST', 'staging');
if (
strpos($_SERVER['HTTP_HOST'], $staging_wp_host) !== false ||
strpos($_SERVER['HTTP_HOST'], $development_wp_host) !== false
) {
define('WP_HOST', strpos($_SERVER['HTTP_HOST'], $staging_wp_host) !== false ? 'staging' : 'development');
} else {
define('WP_HOST', 'production');
}
Expand Down
Loading