Skip to content

Commit

Permalink
WP-NOW: Open browser with blueprint landingPage instead of absoluteUrl (
Browse files Browse the repository at this point in the history
#233)

* Open blueprint landingPage when defined instead of absoluteUrl.
  • Loading branch information
sejas authored Apr 15, 2024
1 parent 270c1e5 commit bca8656
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/wp-now/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface WPNowOptions {
numberOfPhpInstances?: number;
blueprintObject?: Blueprint;
reset?: boolean;
landingPage?: string;
}

export const DEFAULT_OPTIONS: WPNowOptions = {
Expand All @@ -56,6 +57,7 @@ export const DEFAULT_OPTIONS: WPNowOptions = {
mode: WPNowMode.AUTO,
numberOfPhpInstances: 1,
reset: false,
landingPage: '',
};

export interface WPEnvOptions {
Expand Down Expand Up @@ -171,6 +173,10 @@ export default async function getWpNowConfig(
options.absoluteUrl = siteUrl;
absoluteUrlFromBlueprint = siteUrl;
}
if (blueprintObject.landingPage) {
options.landingPage =
(await getAbsoluteURL()) + blueprintObject.landingPage;
}
}
return options;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/wp-now/src/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ export async function startServer(
output?.trace(e);
}
});
const url = options.absoluteUrl;
const url = options.landingPage || options.absoluteUrl;
const server = app.listen(port, () => {
output?.log(`Server running at ${url}`);
output?.log(`Server running at ${options.absoluteUrl}`);
});

return {
Expand Down

0 comments on commit bca8656

Please sign in to comment.