Some checks failed
Deploy to Cloudflare / build-and-deploy (push) Has been cancelled
134 lines
5.5 KiB
TypeScript
134 lines
5.5 KiB
TypeScript
const pageConfig = {
|
|
// Title for your status page
|
|
title: "frytea's Status Page",
|
|
// Links shown at the header of your status page, could set `highlight` to `true`
|
|
links: [
|
|
{ link: 'https://github.com/songtianlun', label: 'GitHub' },
|
|
{ link: 'https://frytea.com/', label: 'Blog' },
|
|
{ link: 'mailto:tianlun.song@foxmail.com', label: 'Email Me', highlight: true },
|
|
],
|
|
// [OPTIONAL] Group your monitors
|
|
// If not specified, all monitors will be shown in a single list
|
|
// If specified, monitors will be grouped and ordered, not-listed monitors will be invisble (but still monitored)
|
|
group: {
|
|
'🌐 Public': ['foo_monitor', 'bar_monitor', 'more monitor ids...'],
|
|
'🔐 Private': ['test_tcp_monitor'],
|
|
},
|
|
}
|
|
|
|
const workerConfig = {
|
|
// Write KV at most every 3 minutes unless the status changed
|
|
kvWriteCooldownMinutes: 3,
|
|
// Enable HTTP Basic auth for status page & API by uncommenting the line below, format `<USERNAME>:<PASSWORD>`
|
|
// passwordProtection: 'username:password',
|
|
// Define all your monitors here
|
|
monitors: [
|
|
{
|
|
id: 'blog',
|
|
name: 'My BLog',
|
|
method: 'GET',
|
|
target: 'https://frytea.com'
|
|
},
|
|
{
|
|
id: 'today_ai_weather',
|
|
name: 'My BLog',
|
|
method: 'GET',
|
|
target: 'https://todayaiweather.com'
|
|
},
|
|
// Example HTTP Monitor
|
|
// {
|
|
// // `id` should be unique, history will be kept if the `id` remains constant
|
|
// id: 'foo_monitor',
|
|
// // `name` is used at status page and callback message
|
|
// name: 'My API Monitor',
|
|
// // `method` should be a valid HTTP Method
|
|
// method: 'POST',
|
|
// // `target` is a valid URL
|
|
// target: 'https://example.com',
|
|
// // [OPTIONAL] `tooltip` is ONLY used at status page to show a tooltip
|
|
// tooltip: 'This is a tooltip for this monitor',
|
|
// // [OPTIONAL] `statusPageLink` is ONLY used for clickable link at status page
|
|
// statusPageLink: 'https://example.com',
|
|
// // [OPTIONAL] `hideLatencyChart` will hide status page latency chart if set to true
|
|
// hideLatencyChart: false,
|
|
// // [OPTIONAL] `expectedCodes` is an array of acceptable HTTP response codes, if not specified, default to 2xx
|
|
// expectedCodes: [200],
|
|
// // [OPTIONAL] `timeout` in millisecond, if not specified, default to 10000
|
|
// timeout: 10000,
|
|
// // [OPTIONAL] headers to be sent
|
|
// headers: {
|
|
// 'User-Agent': 'Uptimeflare',
|
|
// Authorization: 'Bearer YOUR_TOKEN_HERE',
|
|
// },
|
|
// // [OPTIONAL] body to be sent
|
|
// body: 'Hello, world!',
|
|
// // [OPTIONAL] if specified, the response must contains the keyword to be considered as operational.
|
|
// responseKeyword: 'success',
|
|
// // [OPTIONAL] if specified, the response must NOT contains the keyword to be considered as operational.
|
|
// responseForbiddenKeyword: 'bad gateway',
|
|
// // [OPTIONAL] if specified, will call the check proxy to check the monitor, mainly for geo-specific checks
|
|
// // refer to docs https://github.com/lyc8503/UptimeFlare/wiki/Check-proxy-setup before setting this value
|
|
// // currently supports `worker://` and `http(s)://` proxies
|
|
// checkProxy: 'https://xxx.example.com OR worker://weur',
|
|
// // [OPTIONAL] if true, the check will fallback to local if the specified proxy is down
|
|
// checkProxyFallback: true,
|
|
// },
|
|
// // Example TCP Monitor
|
|
// {
|
|
// id: 'test_tcp_monitor',
|
|
// name: 'Example TCP Monitor',
|
|
// // `method` should be `TCP_PING` for tcp monitors
|
|
// method: 'TCP_PING',
|
|
// // `target` should be `host:port` for tcp monitors
|
|
// target: '1.2.3.4:22',
|
|
// tooltip: 'My production server SSH',
|
|
// statusPageLink: 'https://example.com',
|
|
// timeout: 5000,
|
|
// },
|
|
],
|
|
notification: {
|
|
// [Optional] apprise API server URL
|
|
// if not specified, no notification will be sent
|
|
// appriseApiServer: 'https://apprise.example.com/notify',
|
|
// [Optional] recipient URL for apprise, refer to https://github.com/caronc/apprise
|
|
// if not specified, no notification will be sent
|
|
// recipientUrl: 'tgram://bottoken/ChatID',
|
|
// [Optional] timezone used in notification messages, default to "Etc/GMT"
|
|
timeZone: 'Asia/Shanghai',
|
|
// [Optional] grace period in minutes before sending a notification
|
|
// notification will be sent only if the monitor is down for N continuous checks after the initial failure
|
|
// if not specified, notification will be sent immediately
|
|
gracePeriod: 5,
|
|
// [Optional] disable notification for monitors with specified ids
|
|
skipNotificationIds: ['foo_monitor', 'bar_monitor'],
|
|
},
|
|
callbacks: {
|
|
onStatusChange: async (
|
|
env: any,
|
|
monitor: any,
|
|
isUp: boolean,
|
|
timeIncidentStart: number,
|
|
timeNow: number,
|
|
reason: string
|
|
) => {
|
|
// This callback will be called when there's a status change for any monitor
|
|
// Write any Typescript code here
|
|
// This will not follow the grace period settings and will be called immediately when the status changes
|
|
// You need to handle the grace period manually if you want to implement it
|
|
},
|
|
onIncident: async (
|
|
env: any,
|
|
monitor: any,
|
|
timeIncidentStart: number,
|
|
timeNow: number,
|
|
reason: string
|
|
) => {
|
|
// This callback will be called EVERY 1 MINTUE if there's an on-going incident for any monitor
|
|
// Write any Typescript code here
|
|
},
|
|
},
|
|
}
|
|
|
|
// Don't forget this, otherwise compilation fails.
|
|
export { pageConfig, workerConfig }
|