Skip to content

Commit d7e3f21

Browse files
author
Al Manning
committed
lock-down only two testing URLs for publish, prevent pre-testing publishing to production servers
1 parent c7636de commit d7e3f21

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/publish/confluence/confluence-verify.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ConfluenceClient } from "./api/index.ts";
33
import { getMessageFromAPIError } from "./confluence-helper.ts";
44
import { withSpinner } from "../../core/console.ts";
55
import { ConfluenceParent } from "./api/types.ts";
6+
import { VALID_DOMAINS } from "./constants.ts";
67

78
const verifyWithSpinner = async (
89
verifyCommand: () => Promise<void>,
@@ -53,6 +54,16 @@ export const verifyConfluenceParent = async (
5354
parentUrl: string,
5455
parent: ConfluenceParent
5556
) => {
57+
const validURL = VALID_DOMAINS.find((validURL) =>
58+
parentUrl.startsWith(validURL)
59+
);
60+
61+
if (!validURL) {
62+
throw new Error(
63+
`Invalid Testing URL: ${parentUrl}. Valid URLs for testing include: ${VALID_DOMAINS}. After testing is complete, this check will be removed.`
64+
);
65+
}
66+
5667
if (parent.space.length === 0) {
5768
throw new Error("Invalid Confluence parent URL: " + parentUrl);
5869
}

src/publish/confluence/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ export const V2EDITOR_METADATA = {
1313
};
1414

1515
export const DELETE_SLEEP_MILLIS = 1000; //TODO replace with polling
16+
17+
export const VALID_DOMAINS = [
18+
"https://rstudiopbc-sandbox-249.atlassian.net/",
19+
"https://allenmanning.atlassian.net/",
20+
];

0 commit comments

Comments
 (0)