use a more detailed example
parent
459934f852
commit
ee1721ee22
|
|
@ -1,10 +1,12 @@
|
||||||
// Refer to https://github.com/lyc8503/UptimeFlare/wiki/Configuration for detailed information
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
|
// Your locale for server-side callback. (client-side will always follow browser settings)
|
||||||
dateLocale: 'zh-CN',
|
dateLocale: 'zh-CN',
|
||||||
|
// Your timezone for server-side callback. (client-side will always follow browser settings)
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
page: {
|
page: {
|
||||||
|
// Title for your status page
|
||||||
title: "lyc8503's Status Page",
|
title: "lyc8503's Status Page",
|
||||||
|
// Links shown at the header of your status page, could set `highlight` to `true`
|
||||||
links: [
|
links: [
|
||||||
{ link: 'https://github.com/lyc8503', label: 'GitHub' },
|
{ link: 'https://github.com/lyc8503', label: 'GitHub' },
|
||||||
{ link: 'https://blog.lyc8503.site/', label: 'Blog' },
|
{ link: 'https://blog.lyc8503.site/', label: 'Blog' },
|
||||||
|
|
@ -12,33 +14,52 @@ const config = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
callback: async (statusChangeMsg: string) => {
|
callback: async (statusChangeMsg: string) => {
|
||||||
// Add your own callback here
|
// Write any typescript here
|
||||||
|
// Example `statusChangeMsg` string:
|
||||||
|
// "❌My Blog went down at 2023/11/18 14:08:59 with error Timeout after 10000ms"
|
||||||
|
// "✔️My Blog came back up at 2023/11/18 14:10:48 after 2 minutes of downtime"
|
||||||
|
|
||||||
|
// Example:
|
||||||
|
// await fetch('https://api.example.com/callback?msg=' + statusChangeMsg)
|
||||||
},
|
},
|
||||||
|
// Define all your monitors here
|
||||||
monitors: [
|
monitors: [
|
||||||
|
// Example HTTP Monitor
|
||||||
{
|
{
|
||||||
id: 'github',
|
// `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: 'Github Monitor',
|
name: 'Github Monitor',
|
||||||
method: 'GET',
|
// `method` should be a valid HTTP Method
|
||||||
target: 'https://github.com'
|
method: 'POST',
|
||||||
},
|
// `target` is a valid URL
|
||||||
{
|
target: 'https://example.com',
|
||||||
id: 'cloudflare',
|
// [OPTIONAL] `expectedCode` is an array of acceptable HTTP response codes, if not specified, default to 2xx
|
||||||
name: 'Cloudflare Monitor',
|
expectedCode: [200],
|
||||||
method: 'GET',
|
// [OPTIONAL] `timeout` in millisecond, if not specified, default to 10000
|
||||||
target: 'https://cloudflare.com',
|
timeout: 10000,
|
||||||
timeout: 5000,
|
// [OPTIONAL] headers to be sent
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Uptimeflare',
|
'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"
|
||||||
},
|
},
|
||||||
|
// Example TCP Monitor
|
||||||
{
|
{
|
||||||
id: 'sshtest',
|
id: 'test_tcp_monitor',
|
||||||
name: 'SSH Server',
|
name: 'Example TCP Monitor',
|
||||||
|
// `method` should be `TCP_PING` for tcp monitors
|
||||||
method: 'TCP_PING',
|
method: 'TCP_PING',
|
||||||
target: '1.1.1.1:22',
|
// `target` should be `host:port` for tcp monitors
|
||||||
|
target: '1.2.3.4:22',
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't forget this, otherwise compilation fails.
|
||||||
export default config
|
export default config
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue