mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 20:24:47 +00:00
feat: add autoConfig/ better types for wrapperData
This commit is contained in:
@@ -22,7 +22,7 @@ export async function checkPortListening(
|
||||
{
|
||||
error = `Port ${port} is not listening`,
|
||||
message = `Port ${port} is available`,
|
||||
} = {}
|
||||
} = {},
|
||||
): Promise<CheckResult> {
|
||||
const hasAddress =
|
||||
containsAddress(await effects.runCommand(`cat /proc/net/tcp`), port) ||
|
||||
|
||||
@@ -15,7 +15,7 @@ export const checkWebUrl = async (
|
||||
timeout = 1000,
|
||||
successMessage = `Reached ${url}`,
|
||||
errorMessage = `Error while fetching URL: ${url}`,
|
||||
} = {}
|
||||
} = {},
|
||||
): Promise<CheckResult> => {
|
||||
return Promise.race([effects.fetch(url), timeoutPromise(timeout)])
|
||||
.then((x) => ({
|
||||
|
||||
@@ -5,7 +5,7 @@ export { checkWebUrl } from "./checkWebUrl";
|
||||
|
||||
export function timeoutPromise(ms: number, { message = "Timed out" } = {}) {
|
||||
return new Promise<never>((resolve, reject) =>
|
||||
setTimeout(() => reject(new Error(message)), ms)
|
||||
setTimeout(() => reject(new Error(message)), ms),
|
||||
);
|
||||
}
|
||||
export { runHealthScript };
|
||||
|
||||
@@ -17,7 +17,7 @@ export const runHealthScript = async <A extends string>(
|
||||
errorMessage = `Error while running command: ${runCommand}`,
|
||||
message = (res: string) =>
|
||||
`Have ran script ${runCommand} and the result: ${res}`,
|
||||
} = {}
|
||||
} = {},
|
||||
): Promise<CheckResult> => {
|
||||
const res = await Promise.race([
|
||||
effects.runCommand(runCommand, { timeoutMillis: timeout }),
|
||||
|
||||
Reference in New Issue
Block a user