Compare commits

...
27 Commits
Author SHA1 Message Date
TwiN 31bf2aeb80 Update TwiN/health to v1.1.0 2021-11-15 20:11:13 -05:00
TwiN 787f6f0d74 Add feedback email address 2021-11-12 00:32:11 -05:00
TwiN 17a431321c Pass http.NoBody instead of nil as body 2021-11-11 00:14:00 -05:00
TwiN 05e9add16d Regenerate static assets 2021-11-09 00:16:48 -05:00
TwiN c4ef56511d Update dependencies 2021-11-09 00:07:44 -05:00
TwiN cfa2c8ef6f Minor updates 2021-11-09 00:06:41 -05:00
TwiN f36b6863ce Minor update 2021-11-08 23:54:06 -05:00
TwiN 24482cf7a0 Fix icon_url for Mattermost 2021-11-08 21:07:16 -05:00
TwiN d661a0ea6d Add logo.png in .github/assets 2021-11-08 21:05:16 -05:00
TwiN a0ec6941ab Display number of days rather than hours if >72h 2021-11-08 20:57:58 -05:00
TwiN 5e711fb3b9 Use http.Error instead of writer.Write 2021-11-08 20:56:35 -05:00
TwiN ab66e7ec8a Fix badge examples 2021-11-08 02:22:43 -05:00
TwiN 08aba6cd51 Minor updates 2021-11-04 21:40:05 -04:00
TwiN d3805cd77a Fix #197; Fix #198: Deprecate storage.file in favor of storage.path and deprecate persistence with memory storage type 2021-11-04 21:33:13 -04:00
TwiN dd70136e6c Omit empty hostname and errors field 2021-11-03 22:18:23 -04:00
TwiN a94c480c22 Fix typo in comment 2021-11-03 22:17:58 -04:00
TwiN 10fd4ecd6b Minor fixes 2021-11-03 19:48:58 -04:00
TwiN 9287e2f9e2 Move store initialization to store package
This will allow importing storage.Config without importing every SQL drivers in the known universe
2021-10-28 19:35:46 -04:00
TwiN 257f859825 Rename getPagerDutyIntegrationKeyForGroup to getIntegrationKeyForGroup 2021-10-27 23:16:05 -04:00
TwiN 3a4ab62ddd #191: Handle memory issue caused by migration from Service to Endpoint 2021-10-24 21:20:01 -04:00
TwiN a4e9d8e9b0 Revert "Add GATUS_DONT_EXPAND_ENV env var" 2021-10-24 18:34:39 -04:00
TwiN 3be6d04d29 Add GATUS_DONT_EXPAND_ENV env var 2021-10-24 16:20:24 -04:00
TwiN b59ff6f89e Add ServiceAccount to Kubernetes example 2021-10-24 15:33:15 -04:00
TwiN 813fea93ee #167: Rename examples/minimal to .examples/docker-minimal 2021-10-24 15:27:25 -04:00
TwiN 8f50e44b45 #167: Rename examples/ to .examples/ 2021-10-24 15:20:39 -04:00
TwiN fb2448c15a Omit fields that are not set 2021-10-24 15:03:41 -04:00
TwiN db575aad13 Remove comments that no longer apply 2021-10-24 14:51:49 -04:00
69 changed files with 2533 additions and 3709 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
examples .examples
Dockerfile Dockerfile
.github .github
.idea .idea
@@ -1,6 +1,6 @@
storage: storage:
type: postgres type: postgres
file: "postgres://username:password@postgres:5432/gatus?sslmode=disable" path: "postgres://username:password@postgres:5432/gatus?sslmode=disable"
endpoints: endpoints:
- name: back-end - name: back-end
@@ -1,6 +1,6 @@
storage: storage:
type: sqlite type: sqlite
file: /data/data.db path: /data/data.db
endpoints: endpoints:
- name: back-end - name: back-end
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -9,14 +9,17 @@ data:
endpoints: endpoints:
- name: website - name: website
url: https://twin.sh/health url: https://twin.sh/health
interval: 1m interval: 5m
conditions: conditions:
- "[STATUS] == 200" - "[STATUS] == 200"
- "[BODY].status == UP"
- name: github - name: github
url: https://api.github.com/healthz url: https://api.github.com/healthz
interval: 5m interval: 5m
conditions: conditions:
- "[STATUS] == 200" - "[STATUS] == 200"
- name: cat-fact - name: cat-fact
url: "https://cat-fact.herokuapp.com/facts/random" url: "https://cat-fact.herokuapp.com/facts/random"
interval: 5m interval: 5m
@@ -27,11 +30,18 @@ data:
- "[BODY].text == pat(*cat*)" - "[BODY].text == pat(*cat*)"
- "[STATUS] == pat(2*)" - "[STATUS] == pat(2*)"
- "[CONNECTED] == true" - "[CONNECTED] == true"
- name: example - name: example
url: https://example.com/ url: https://example.com/
conditions: conditions:
- "[STATUS] == 200" - "[STATUS] == 200"
--- ---
apiVersion: v1
kind: ServiceAccount
metadata:
name: gatus
namespace: kube-system
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -41,14 +51,16 @@ spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
k8s-app: gatus app: gatus
template: template:
metadata: metadata:
labels: labels:
k8s-app: gatus app: gatus
name: gatus name: gatus
namespace: kube-system namespace: kube-system
spec: spec:
serviceAccountName: gatus
terminationGracePeriodSeconds: 5
containers: containers:
- image: twinproduction/gatus - image: twinproduction/gatus
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
@@ -84,4 +96,4 @@ spec:
protocol: TCP protocol: TCP
targetPort: 8080 targetPort: 8080
selector: selector:
k8s-app: gatus app: gatus
Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

+4 -4
View File
@@ -17,7 +17,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.17
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Build binary to make sure it works - name: Build binary to make sure it works
@@ -25,9 +25,9 @@ jobs:
- name: Test - name: Test
# We're using "sudo" because one of the tests leverages ping, which requires super-user privileges. # We're using "sudo" because one of the tests leverages ping, which requires super-user privileges.
# As for the 'env "PATH=$PATH" "GOROOT=$GOROOT"', we need it to use the same "go" executable that # As for the 'env "PATH=$PATH" "GOROOT=$GOROOT"', we need it to use the same "go" executable that
# was configured by the "Set up Go 1.15" step (otherwise, it'd use sudo's "go" executable) # was configured by the "Set up Go" step (otherwise, it'd use sudo's "go" executable)
run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test -mod vendor ./... -race -coverprofile=coverage.txt -covermode=atomic run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test -mod vendor ./... -race -coverprofile=coverage.txt -covermode=atomic
- name: Codecov - name: Codecov
uses: codecov/codecov-action@v1.5.2 uses: codecov/codecov-action@v2.1.0
with: with:
file: ./coverage.txt files: ./coverage.txt
+37 -31
View File
@@ -19,12 +19,13 @@ core applications: https://status.twin.sh/
<details> <details>
<summary><b>Quick start</b></summary> <summary><b>Quick start</b></summary>
``` ```console
docker run -p 8080:8080 --name gatus twinproduction/gatus docker run -p 8080:8080 --name gatus twinproduction/gatus
``` ```
For more details, see [Usage](#usage) For more details, see [Usage](#usage)
</details> </details>
Have any feedback or want to share your good/bad experience with Gatus? Feel free to email me at [feedback@gatus.io](mailto:feedback@gatus.io)
## Table of Contents ## Table of Contents
- [Why Gatus?](#why-gatus) - [Why Gatus?](#why-gatus)
@@ -103,7 +104,7 @@ The main features of Gatus are:
- **Alerting**: While having a pretty visual dashboard is useful to keep track of the state of your application(s), you probably don't want to stare at it all day. Thus, notifications via Slack, Mattermost, Messagebird, PagerDuty, Twilio and Teams are supported out of the box with the ability to configure a custom alerting provider for any needs you might have, whether it be a different provider or a custom application that manages automated rollbacks. - **Alerting**: While having a pretty visual dashboard is useful to keep track of the state of your application(s), you probably don't want to stare at it all day. Thus, notifications via Slack, Mattermost, Messagebird, PagerDuty, Twilio and Teams are supported out of the box with the ability to configure a custom alerting provider for any needs you might have, whether it be a different provider or a custom application that manages automated rollbacks.
- **Metrics** - **Metrics**
- **Low resource consumption**: As with most Go applications, the resource footprint that this application requires is negligibly small. - **Low resource consumption**: As with most Go applications, the resource footprint that this application requires is negligibly small.
- **[Badges](#badges)**: ![Uptime 7d](https://status.twin.sh/api/v1/endpoints/core_website-external/uptimes/7d/badge.svg) ![Response time 24h](https://status.twin.sh/api/v1/endpoints/core_website-external/response-times/24h/badge.svg) - **[Badges](#badges)**: ![Uptime 7d](https://status.twin.sh/api/v1/endpoints/core_blog-external/uptimes/7d/badge.svg) ![Response time 24h](https://status.twin.sh/api/v1/endpoints/core_blog-external/response-times/24h/badge.svg)
## Usage ## Usage
@@ -235,26 +236,31 @@ Here are some examples of conditions you can use:
| Parameter | Description | Default | | Parameter | Description | Default |
|:------------------ |:-------------------------------------------------------------------------------------- |:-------------- | |:------------------ |:-------------------------------------------------------------------------------------- |:-------------- |
| `storage` | Storage configuration | `{}` | | `storage` | Storage configuration | `{}` |
| `storage.file` | Path to persist the data in. If the type is `memory`, data is persisted on interval. | `""` | | `storage.path` | Path to persist the data in. Only supported for types `sqlite` and `postgres`. | `""` |
| `storage.type` | Type of storage. Valid types: `memory`, `sqlite`, `postgres` (ALPHA). | `"memory"` | | `storage.type` | Type of storage. Valid types: `memory`, `sqlite`, `postgres`. | `"memory"` |
- If `storage.type` is `memory` (default) and `storage.file` is set to a non-blank value. - If `storage.type` is `memory` (default):
Furthermore, the data is periodically persisted, but everything remains in memory. ```yaml
- If `storage.type` is `sqlite`, `storage.file` must not be blank: # Note that this is the default value, and you can omit the storage configuration altogether to achieve the same result.
# Because the data is stored in memory, the data will not survive a restart.
storage:
type: memory
```
- If `storage.type` is `sqlite`, `storage.path` must not be blank:
```yaml ```yaml
storage: storage:
type: sqlite type: sqlite
file: data.db path: data.db
``` ```
See [examples/docker-compose-sqlite-storage](examples/docker-compose-sqlite-storage) for an example. See [examples/docker-compose-sqlite-storage](.examples/docker-compose-sqlite-storage) for an example.
- If `storage.type` is `postgres`, `storage.file` must be the connection URL: - If `storage.type` is `postgres`, `storage.path` must be the connection URL:
```yaml ```yaml
storage: storage:
type: postgres type: postgres
file: "postgres://user:password@127.0.0.1:5432/gatus?sslmode=disable" path: "postgres://user:password@127.0.0.1:5432/gatus?sslmode=disable"
``` ```
See [examples/docker-compose-postgres-storage](examples/docker-compose-postgres-storage) for an example. See [examples/docker-compose-postgres-storage](.examples/docker-compose-postgres-storage) for an example.
### Client configuration ### Client configuration
@@ -798,29 +804,29 @@ maintenance:
## Deployment ## Deployment
Many examples can be found in the [examples](examples) folder, but this section will focus on the most popular ways of deploying Gatus. Many examples can be found in the [.examples](.examples) folder, but this section will focus on the most popular ways of deploying Gatus.
### Docker ### Docker
To run Gatus locally with Docker: To run Gatus locally with Docker:
``` ```console
docker run -p 8080:8080 --name gatus twinproduction/gatus docker run -p 8080:8080 --name gatus twinproduction/gatus
``` ```
Other than using one of the examples provided in the `examples` folder, you can also try it out locally by Other than using one of the examples provided in the [.examples](.examples) folder, you can also try it out locally by
creating a configuration file, we'll call it `config.yaml` for this example, and running the following creating a configuration file, we'll call it `config.yaml` for this example, and running the following
command: command:
``` ```console
docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/config.yaml,target=/config/config.yaml --name gatus twinproduction/gatus docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/config.yaml,target=/config/config.yaml --name gatus twinproduction/gatus
``` ```
If you're on Windows, replace `"$(pwd)"` by the absolute path to your current directory, e.g.: If you're on Windows, replace `"$(pwd)"` by the absolute path to your current directory, e.g.:
``` ```console
docker run -p 8080:8080 --mount type=bind,source=C:/Users/Chris/Desktop/config.yaml,target=/config/config.yaml --name gatus twinproduction/gatus docker run -p 8080:8080 --mount type=bind,source=C:/Users/Chris/Desktop/config.yaml,target=/config/config.yaml --name gatus twinproduction/gatus
``` ```
To build the image locally: To build the image locally:
``` ```console
docker build . -t twinproduction/gatus docker build . -t twinproduction/gatus
``` ```
@@ -845,7 +851,7 @@ Gatus can be deployed on Terraform by using the following module: [terraform-kub
## Running the tests ## Running the tests
``` ```console
go test ./... -mod vendor go test ./... -mod vendor
``` ```
@@ -937,8 +943,8 @@ endpoints:
- "[CONNECTED] == true" - "[CONNECTED] == true"
``` ```
Placeholders `[STATUS]` and `[BODY]` as well as the fields `endpoints[].body`, `endpoints[].insecure`, Placeholders `[STATUS]` and `[BODY]` as well as the fields `endpoints[].body`, `endpoints[].headers`,
`endpoints[].headers`, `endpoints[].method` and `endpoints[].graphql` are not supported for TCP endpoints. `endpoints[].method` and `endpoints[].graphql` are not supported for TCP endpoints.
**NOTE**: `[CONNECTED] == true` does not guarantee that the endpoint itself is healthy - it only guarantees that there's **NOTE**: `[CONNECTED] == true` does not guarantee that the endpoint itself is healthy - it only guarantees that there's
something at the given address listening to the given port, and that a connection to that address was successfully something at the given address listening to the given port, and that a connection to that address was successfully
@@ -991,7 +997,7 @@ endpoints:
url: "starttls://smtp.gmail.com:587" url: "starttls://smtp.gmail.com:587"
interval: 30m interval: 30m
client: client:
timeout: 5s timeout: 5s
conditions: conditions:
- "[CONNECTED] == true" - "[CONNECTED] == true"
- "[CERTIFICATE_EXPIRATION] > 48h" - "[CERTIFICATE_EXPIRATION] > 48h"
@@ -1006,7 +1012,7 @@ endpoints:
url: "tls://ldap.example.com:636" url: "tls://ldap.example.com:636"
interval: 30m interval: 30m
client: client:
timeout: 5s timeout: 5s
conditions: conditions:
- "[CONNECTED] == true" - "[CONNECTED] == true"
- "[CERTIFICATE_EXPIRATION] > 48h" - "[CERTIFICATE_EXPIRATION] > 48h"
@@ -1124,9 +1130,9 @@ web:
### Badges ### Badges
### Uptime ### Uptime
![Uptime 1h](https://status.twin.sh/api/v1/endpoints/core_website-external/uptimes/1h/badge.svg) ![Uptime 1h](https://status.twin.sh/api/v1/endpoints/core_blog-external/uptimes/1h/badge.svg)
![Uptime 24h](https://status.twin.sh/api/v1/endpoints/core_website-external/uptimes/24h/badge.svg) ![Uptime 24h](https://status.twin.sh/api/v1/endpoints/core_blog-external/uptimes/24h/badge.svg)
![Uptime 7d](https://status.twin.sh/api/v1/endpoints/core_website-external/uptimes/7d/badge.svg) ![Uptime 7d](https://status.twin.sh/api/v1/endpoints/core_blog-external/uptimes/7d/badge.svg)
Gatus can automatically generate a SVG badge for one of your monitored endpoints. Gatus can automatically generate a SVG badge for one of your monitored endpoints.
This allows you to put badges in your individual applications' README or even create your own status page, if you This allows you to put badges in your individual applications' README or even create your own status page, if you
@@ -1151,15 +1157,15 @@ https://example.com/api/v1/endpoints/_frontend/uptimes/7d/badge.svg
``` ```
Example: Example:
``` ```
![Uptime 24h](https://status.twin.sh/api/v1/endpoints/core_website-external/uptimes/24h/badge.svg) ![Uptime 24h](https://status.twin.sh/api/v1/endpoints/core_blog-external/uptimes/24h/badge.svg)
``` ```
If you'd like to see a visual example of each badges available, you can simply navigate to the endpoint's detail page. If you'd like to see a visual example of each badges available, you can simply navigate to the endpoint's detail page.
### Response time ### Response time
![Response time 1h](https://status.twin.sh/api/v1/endpoints/core_website-external/response-times/1h/badge.svg) ![Response time 1h](https://status.twin.sh/api/v1/endpoints/core_blog-external/response-times/1h/badge.svg)
![Response time 24h](https://status.twin.sh/api/v1/endpoints/core_website-external/response-times/24h/badge.svg) ![Response time 24h](https://status.twin.sh/api/v1/endpoints/core_blog-external/response-times/24h/badge.svg)
![Response time 7d](https://status.twin.sh/api/v1/endpoints/core_website-external/response-times/7d/badge.svg) ![Response time 7d](https://status.twin.sh/api/v1/endpoints/core_blog-external/response-times/7d/badge.svg)
The endpoint to generate a badge is the following: The endpoint to generate a badge is the following:
``` ```
@@ -1183,7 +1189,7 @@ Specific endpoints can also be queried by using the following pattern:
``` ```
/api/v1/endpoints/{group}_{endpoint}/statuses /api/v1/endpoints/{group}_{endpoint}/statuses
``` ```
Example: https://status.twin.sh/api/v1/endpoints/core_website-home/statuses Example: https://status.twin.sh/api/v1/endpoints/core_blog-home/statuses
Gzip compression will be used if the `Accept-Encoding` HTTP header contains `gzip`. Gzip compression will be used if the `Accept-Encoding` HTTP header contains `gzip`.
+1 -1
View File
@@ -61,7 +61,7 @@ func (provider *AlertProvider) ToCustomAlertProvider(endpoint *core.Endpoint, al
Body: fmt.Sprintf(`{ Body: fmt.Sprintf(`{
"text": "", "text": "",
"username": "gatus", "username": "gatus",
"icon_url": "https://raw.githubusercontent.com/TwiN/gatus/master/static/logo.png", "icon_url": "https://raw.githubusercontent.com/TwiN/gatus/master/.github/assets/logo.png",
"attachments": [ "attachments": [
{ {
"title": ":rescue_worker_helmet: Gatus", "title": ":rescue_worker_helmet: Gatus",
+4 -7
View File
@@ -71,15 +71,15 @@ func (provider *AlertProvider) ToCustomAlertProvider(endpoint *core.Endpoint, al
"source": "%s", "source": "%s",
"severity": "critical" "severity": "critical"
} }
}`, provider.getPagerDutyIntegrationKeyForGroup(endpoint.Group), resolveKey, eventAction, message, endpoint.Name), }`, provider.getIntegrationKeyForGroup(endpoint.Group), resolveKey, eventAction, message, endpoint.Name),
Headers: map[string]string{ Headers: map[string]string{
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
} }
} }
// getPagerDutyIntegrationKeyForGroup returns the appropriate pagerduty integration key for a given group // getIntegrationKeyForGroup returns the appropriate pagerduty integration key for a given group
func (provider *AlertProvider) getPagerDutyIntegrationKeyForGroup(group string) string { func (provider *AlertProvider) getIntegrationKeyForGroup(group string) string {
if provider.Overrides != nil { if provider.Overrides != nil {
for _, override := range provider.Overrides { for _, override := range provider.Overrides {
if group == override.Group { if group == override.Group {
@@ -87,10 +87,7 @@ func (provider *AlertProvider) getPagerDutyIntegrationKeyForGroup(group string)
} }
} }
} }
if provider.IntegrationKey != "" { return provider.IntegrationKey
return provider.IntegrationKey
}
return ""
} }
// GetDefaultAlert returns the provider's default alert configuration // GetDefaultAlert returns the provider's default alert configuration
@@ -161,7 +161,7 @@ func TestAlertProvider_ToCustomAlertProviderWithTriggeredAlertAndOverride(t *tes
} }
} }
func TestAlertProvider_getPagerDutyIntegrationKey(t *testing.T) { func TestAlertProvider_getIntegrationKeyForGroup(t *testing.T) {
scenarios := []struct { scenarios := []struct {
Name string Name string
Provider AlertProvider Provider AlertProvider
@@ -217,7 +217,7 @@ func TestAlertProvider_getPagerDutyIntegrationKey(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
if output := scenario.Provider.getPagerDutyIntegrationKeyForGroup(scenario.InputGroup); output != scenario.ExpectedOutput { if output := scenario.Provider.getIntegrationKeyForGroup(scenario.InputGroup); output != scenario.ExpectedOutput {
t.Errorf("expected %s, got %s", scenario.ExpectedOutput, output) t.Errorf("expected %s, got %s", scenario.ExpectedOutput, output)
} }
}) })
+18 -29
View File
@@ -43,28 +43,28 @@ var (
// Config is the main configuration structure // Config is the main configuration structure
type Config struct { type Config struct {
// Debug Whether to enable debug logs // Debug Whether to enable debug logs
Debug bool `yaml:"debug"` Debug bool `yaml:"debug,omitempty"`
// Metrics Whether to expose metrics at /metrics // Metrics Whether to expose metrics at /metrics
Metrics bool `yaml:"metrics"` Metrics bool `yaml:"metrics,omitempty"`
// SkipInvalidConfigUpdate Whether to make the application ignore invalid configuration // SkipInvalidConfigUpdate Whether to make the application ignore invalid configuration
// if the configuration file is updated while the application is running // if the configuration file is updated while the application is running
SkipInvalidConfigUpdate bool `yaml:"skip-invalid-config-update"` SkipInvalidConfigUpdate bool `yaml:"skip-invalid-config-update,omitempty"`
// DisableMonitoringLock Whether to disable the monitoring lock // DisableMonitoringLock Whether to disable the monitoring lock
// The monitoring lock is what prevents multiple endpoints from being processed at the same time. // The monitoring lock is what prevents multiple endpoints from being processed at the same time.
// Disabling this may lead to inaccurate response times // Disabling this may lead to inaccurate response times
DisableMonitoringLock bool `yaml:"disable-monitoring-lock"` DisableMonitoringLock bool `yaml:"disable-monitoring-lock,omitempty"`
// Security Configuration for securing access to Gatus // Security Configuration for securing access to Gatus
Security *security.Config `yaml:"security"` Security *security.Config `yaml:"security,omitempty"`
// Alerting Configuration for alerting // Alerting Configuration for alerting
Alerting *alerting.Config `yaml:"alerting"` Alerting *alerting.Config `yaml:"alerting,omitempty"`
// Endpoints List of endpoints to monitor // Endpoints List of endpoints to monitor
Endpoints []*core.Endpoint `yaml:"endpoints"` Endpoints []*core.Endpoint `yaml:"endpoints,omitempty"`
// Services List of endpoints to monitor // Services List of endpoints to monitor
// //
@@ -72,19 +72,19 @@ type Config struct {
// XXX: This is not a typo -- not v4.0.0, but v5.0.0 -- I want to give enough time for people to migrate // XXX: This is not a typo -- not v4.0.0, but v5.0.0 -- I want to give enough time for people to migrate
// //
// Deprecated in favor of Endpoints // Deprecated in favor of Endpoints
Services []*core.Endpoint `yaml:"services"` Services []*core.Endpoint `yaml:"services,omitempty"`
// Storage is the configuration for how the data is stored // Storage is the configuration for how the data is stored
Storage *storage.Config `yaml:"storage"` Storage *storage.Config `yaml:"storage,omitempty"`
// Web is the web configuration for the application // Web is the web configuration for the application
Web *web.Config `yaml:"web"` Web *web.Config `yaml:"web,omitempty"`
// UI is the configuration for the UI // UI is the configuration for the UI
UI *ui.Config `yaml:"ui"` UI *ui.Config `yaml:"ui,omitempty"`
// Maintenance is the configuration for creating a maintenance window in which no alerts are sent // Maintenance is the configuration for creating a maintenance window in which no alerts are sent
Maintenance *maintenance.Config `yaml:"maintenance"` Maintenance *maintenance.Config `yaml:"maintenance,omitempty"`
filePath string // path to the file from which config was loaded from filePath string // path to the file from which config was loaded from
lastFileModTime time.Time // last modification time lastFileModTime time.Time // last modification time
@@ -149,12 +149,12 @@ func readConfigurationFile(fileName string) (config *Config, err error) {
return return
} }
// parseAndValidateConfigBytes parses a Gatus configuration file into a Config struct and validates its parameters
func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) { func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
// Expand environment variables // Expand environment variables
yamlBytes = []byte(os.ExpandEnv(string(yamlBytes))) yamlBytes = []byte(os.ExpandEnv(string(yamlBytes)))
// Parse configuration file // Parse configuration file
err = yaml.Unmarshal(yamlBytes, &config) if err = yaml.Unmarshal(yamlBytes, &config); err != nil {
if err != nil {
return return
} }
if config != nil && len(config.Services) > 0 { // XXX: Remove this in v5.0.0 if config != nil && len(config.Services) > 0 { // XXX: Remove this in v5.0.0
@@ -167,8 +167,6 @@ func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
if config == nil || config.Endpoints == nil || len(config.Endpoints) == 0 { if config == nil || config.Endpoints == nil || len(config.Endpoints) == 0 {
err = ErrNoEndpointInConfig err = ErrNoEndpointInConfig
} else { } else {
// Note that the functions below may panic, and this is on purpose to prevent Gatus from starting with
// invalid configurations
validateAlertingConfig(config.Alerting, config.Endpoints, config.Debug) validateAlertingConfig(config.Alerting, config.Endpoints, config.Debug)
if err := validateSecurityConfig(config); err != nil { if err := validateSecurityConfig(config); err != nil {
return nil, err return nil, err
@@ -197,19 +195,10 @@ func validateStorageConfig(config *Config) error {
config.Storage = &storage.Config{ config.Storage = &storage.Config{
Type: storage.TypeMemory, Type: storage.TypeMemory,
} }
} } else {
err := storage.Initialize(config.Storage) if err := config.Storage.ValidateAndSetDefaults(); err != nil {
if err != nil { return err
return err }
}
// Remove all EndpointStatus that represent endpoints which no longer exist in the configuration
var keys []string
for _, endpoint := range config.Endpoints {
keys = append(keys, endpoint.Key())
}
numberOfEndpointStatusesDeleted := storage.Get().DeleteAllEndpointStatusesNotInKeys(keys)
if numberOfEndpointStatusesDeleted > 0 {
log.Printf("[config][validateStorageConfig] Deleted %d endpoint statuses because their matching endpoints no longer existed", numberOfEndpointStatusesDeleted)
} }
return nil return nil
} }
+56 -1
View File
@@ -20,6 +20,7 @@ import (
"github.com/TwiN/gatus/v3/config/ui" "github.com/TwiN/gatus/v3/config/ui"
"github.com/TwiN/gatus/v3/config/web" "github.com/TwiN/gatus/v3/config/web"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage"
) )
func TestLoadFileThatDoesNotExist(t *testing.T) { func TestLoadFileThatDoesNotExist(t *testing.T) {
@@ -44,7 +45,8 @@ func TestParseAndValidateConfigBytes(t *testing.T) {
}() }()
config, err := parseAndValidateConfigBytes([]byte(fmt.Sprintf(` config, err := parseAndValidateConfigBytes([]byte(fmt.Sprintf(`
storage: storage:
file: %s type: sqlite
path: %s
maintenance: maintenance:
enabled: true enabled: true
start: 00:00 start: 00:00
@@ -83,6 +85,9 @@ endpoints:
if config == nil { if config == nil {
t.Fatal("Config shouldn't have been nil") t.Fatal("Config shouldn't have been nil")
} }
if config.Storage == nil || config.Storage.Path != file || config.Storage.Type != storage.TypeSQLite {
t.Error("expected storage to be set to sqlite, got", config.Storage)
}
if config.UI == nil || config.UI.Title != "Test" { if config.UI == nil || config.UI.Title != "Test" {
t.Error("Expected Config.UI.Title to be Test") t.Error("Expected Config.UI.Title to be Test")
} }
@@ -1297,3 +1302,53 @@ endpoints:
t.Error("services should've been merged in endpoints") t.Error("services should've been merged in endpoints")
} }
} }
// XXX: Remove this in v4.0.0
func TestParseAndValidateConfigBytes_backwardCompatibleWithStorageFile(t *testing.T) {
file := t.TempDir() + "/test.db"
config, err := parseAndValidateConfigBytes([]byte(fmt.Sprintf(`
storage:
type: sqlite
file: %s
endpoints:
- name: website
url: https://twin.sh/actuator/health
conditions:
- "[STATUS] == 200"
`, file)))
if err != nil {
t.Error("expected no error, got", err.Error())
}
if config == nil {
t.Fatal("Config shouldn't have been nil")
}
if config.Storage == nil || config.Storage.Path != file || config.Storage.Type != storage.TypeSQLite {
t.Error("expected storage to be set to sqlite, got", config.Storage)
}
}
// XXX: Remove this in v4.0.0
func TestParseAndValidateConfigBytes_backwardCompatibleWithStorageTypeMemoryAndFile(t *testing.T) {
file := t.TempDir() + "/test.db"
config, err := parseAndValidateConfigBytes([]byte(fmt.Sprintf(`
storage:
type: memory
file: %s
endpoints:
- name: website
url: https://twin.sh/actuator/health
conditions:
- "[STATUS] == 200"
`, file)))
if err != nil {
t.Error("expected no error, got", err.Error())
}
if config == nil {
t.Fatal("Config shouldn't have been nil")
}
if config.Storage == nil || config.Storage.Path != file || config.Storage.Type != storage.TypeMemory {
t.Error("expected storage to be set to memory, got", config.Storage)
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ func TestHandle(t *testing.T) {
defer os.Clearenv() defer os.Clearenv()
Handle(cfg.Security, cfg.Web, cfg.UI, cfg.Metrics) Handle(cfg.Security, cfg.Web, cfg.UI, cfg.Metrics)
defer Shutdown() defer Shutdown()
request, _ := http.NewRequest("GET", "/health", nil) request, _ := http.NewRequest("GET", "/health", http.NoBody)
responseRecorder := httptest.NewRecorder() responseRecorder := httptest.NewRecorder()
server.Handler.ServeHTTP(responseRecorder, request) server.Handler.ServeHTTP(responseRecorder, request)
if responseRecorder.Code != http.StatusOK { if responseRecorder.Code != http.StatusOK {
+9 -11
View File
@@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/storage/store/common" "github.com/TwiN/gatus/v3/storage/store/common"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
@@ -40,16 +40,15 @@ func UptimeBadge(writer http.ResponseWriter, request *http.Request) {
return return
} }
key := variables["key"] key := variables["key"]
uptime, err := storage.Get().GetUptimeByKey(key, from, time.Now()) uptime, err := store.Get().GetUptimeByKey(key, from, time.Now())
if err != nil { if err != nil {
if err == common.ErrEndpointNotFound { if err == common.ErrEndpointNotFound {
writer.WriteHeader(http.StatusNotFound) http.Error(writer, err.Error(), http.StatusNotFound)
} else if err == common.ErrInvalidTimeRange { } else if err == common.ErrInvalidTimeRange {
writer.WriteHeader(http.StatusBadRequest) http.Error(writer, err.Error(), http.StatusBadRequest)
} else { } else {
writer.WriteHeader(http.StatusInternalServerError) http.Error(writer, err.Error(), http.StatusInternalServerError)
} }
_, _ = writer.Write([]byte(err.Error()))
return return
} }
formattedDate := time.Now().Format(http.TimeFormat) formattedDate := time.Now().Format(http.TimeFormat)
@@ -79,16 +78,15 @@ func ResponseTimeBadge(writer http.ResponseWriter, request *http.Request) {
return return
} }
key := variables["key"] key := variables["key"]
averageResponseTime, err := storage.Get().GetAverageResponseTimeByKey(key, from, time.Now()) averageResponseTime, err := store.Get().GetAverageResponseTimeByKey(key, from, time.Now())
if err != nil { if err != nil {
if err == common.ErrEndpointNotFound { if err == common.ErrEndpointNotFound {
writer.WriteHeader(http.StatusNotFound) http.Error(writer, err.Error(), http.StatusNotFound)
} else if err == common.ErrInvalidTimeRange { } else if err == common.ErrInvalidTimeRange {
writer.WriteHeader(http.StatusBadRequest) http.Error(writer, err.Error(), http.StatusBadRequest)
} else { } else {
writer.WriteHeader(http.StatusInternalServerError) http.Error(writer, err.Error(), http.StatusInternalServerError)
} }
_, _ = writer.Write([]byte(err.Error()))
return return
} }
formattedDate := time.Now().Format(http.TimeFormat) formattedDate := time.Now().Format(http.TimeFormat)
+3 -3
View File
@@ -9,12 +9,12 @@ import (
"github.com/TwiN/gatus/v3/config" "github.com/TwiN/gatus/v3/config"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/watchdog" "github.com/TwiN/gatus/v3/watchdog"
) )
func TestUptimeBadge(t *testing.T) { func TestUptimeBadge(t *testing.T) {
defer storage.Get().Clear() defer store.Get().Clear()
defer cache.Clear() defer cache.Clear()
cfg := &config.Config{ cfg := &config.Config{
Metrics: true, Metrics: true,
@@ -107,7 +107,7 @@ func TestUptimeBadge(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
if scenario.Gzip { if scenario.Gzip {
request.Header.Set("Accept-Encoding", "gzip") request.Header.Set("Accept-Encoding", "gzip")
} }
+6 -8
View File
@@ -7,7 +7,7 @@ import (
"sort" "sort"
"time" "time"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/storage/store/common" "github.com/TwiN/gatus/v3/storage/store/common"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/wcharczuk/go-chart/v2" "github.com/wcharczuk/go-chart/v2"
@@ -42,21 +42,19 @@ func ResponseTimeChart(writer http.ResponseWriter, r *http.Request) {
http.Error(writer, "Durations supported: 7d, 24h", http.StatusBadRequest) http.Error(writer, "Durations supported: 7d, 24h", http.StatusBadRequest)
return return
} }
hourlyAverageResponseTime, err := storage.Get().GetHourlyAverageResponseTimeByKey(vars["key"], from, time.Now()) hourlyAverageResponseTime, err := store.Get().GetHourlyAverageResponseTimeByKey(vars["key"], from, time.Now())
if err != nil { if err != nil {
if err == common.ErrEndpointNotFound { if err == common.ErrEndpointNotFound {
writer.WriteHeader(http.StatusNotFound) http.Error(writer, err.Error(), http.StatusNotFound)
} else if err == common.ErrInvalidTimeRange { } else if err == common.ErrInvalidTimeRange {
writer.WriteHeader(http.StatusBadRequest) http.Error(writer, err.Error(), http.StatusBadRequest)
} else { } else {
writer.WriteHeader(http.StatusInternalServerError) http.Error(writer, err.Error(), http.StatusInternalServerError)
} }
_, _ = writer.Write([]byte(err.Error()))
return return
} }
if len(hourlyAverageResponseTime) == 0 { if len(hourlyAverageResponseTime) == 0 {
writer.WriteHeader(http.StatusNoContent) http.Error(writer, "", http.StatusNoContent)
_, _ = writer.Write(nil)
return return
} }
series := chart.TimeSeries{ series := chart.TimeSeries{
+3 -3
View File
@@ -8,12 +8,12 @@ import (
"github.com/TwiN/gatus/v3/config" "github.com/TwiN/gatus/v3/config"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/watchdog" "github.com/TwiN/gatus/v3/watchdog"
) )
func TestResponseTimeChart(t *testing.T) { func TestResponseTimeChart(t *testing.T) {
defer storage.Get().Clear() defer store.Get().Clear()
defer cache.Clear() defer cache.Clear()
cfg := &config.Config{ cfg := &config.Config{
Metrics: true, Metrics: true,
@@ -66,7 +66,7 @@ func TestResponseTimeChart(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
if scenario.Gzip { if scenario.Gzip {
request.Header.Set("Accept-Encoding", "gzip") request.Header.Set("Accept-Encoding", "gzip")
} }
+3 -3
View File
@@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/storage/store/common" "github.com/TwiN/gatus/v3/storage/store/common"
"github.com/TwiN/gatus/v3/storage/store/common/paging" "github.com/TwiN/gatus/v3/storage/store/common/paging"
"github.com/TwiN/gocache" "github.com/TwiN/gocache"
@@ -44,7 +44,7 @@ func EndpointStatuses(writer http.ResponseWriter, r *http.Request) {
var err error var err error
buffer := &bytes.Buffer{} buffer := &bytes.Buffer{}
gzipWriter := gzip.NewWriter(buffer) gzipWriter := gzip.NewWriter(buffer)
endpointStatuses, err := storage.Get().GetAllEndpointStatuses(paging.NewEndpointStatusParams().WithResults(page, pageSize)) endpointStatuses, err := store.Get().GetAllEndpointStatuses(paging.NewEndpointStatusParams().WithResults(page, pageSize))
if err != nil { if err != nil {
log.Printf("[handler][EndpointStatuses] Failed to retrieve endpoint statuses: %s", err.Error()) log.Printf("[handler][EndpointStatuses] Failed to retrieve endpoint statuses: %s", err.Error())
http.Error(writer, err.Error(), http.StatusInternalServerError) http.Error(writer, err.Error(), http.StatusInternalServerError)
@@ -76,7 +76,7 @@ func EndpointStatuses(writer http.ResponseWriter, r *http.Request) {
func EndpointStatus(writer http.ResponseWriter, r *http.Request) { func EndpointStatus(writer http.ResponseWriter, r *http.Request) {
page, pageSize := extractPageAndPageSizeFromRequest(r) page, pageSize := extractPageAndPageSizeFromRequest(r)
vars := mux.Vars(r) vars := mux.Vars(r)
endpointStatus, err := storage.Get().GetEndpointStatusByKey(vars["key"], paging.NewEndpointStatusParams().WithResults(page, pageSize).WithEvents(1, common.MaximumNumberOfEvents)) endpointStatus, err := store.Get().GetEndpointStatusByKey(vars["key"], paging.NewEndpointStatusParams().WithResults(page, pageSize).WithEvents(1, common.MaximumNumberOfEvents))
if err != nil { if err != nil {
if err == common.ErrEndpointNotFound { if err == common.ErrEndpointNotFound {
http.Error(writer, err.Error(), http.StatusNotFound) http.Error(writer, err.Error(), http.StatusNotFound)
+13 -13
View File
@@ -8,7 +8,7 @@ import (
"github.com/TwiN/gatus/v3/config" "github.com/TwiN/gatus/v3/config"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/watchdog" "github.com/TwiN/gatus/v3/watchdog"
) )
@@ -84,7 +84,7 @@ var (
) )
func TestEndpointStatus(t *testing.T) { func TestEndpointStatus(t *testing.T) {
defer storage.Get().Clear() defer store.Get().Clear()
defer cache.Clear() defer cache.Clear()
cfg := &config.Config{ cfg := &config.Config{
Metrics: true, Metrics: true,
@@ -139,7 +139,7 @@ func TestEndpointStatus(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
if scenario.Gzip { if scenario.Gzip {
request.Header.Set("Accept-Encoding", "gzip") request.Header.Set("Accept-Encoding", "gzip")
} }
@@ -153,12 +153,12 @@ func TestEndpointStatus(t *testing.T) {
} }
func TestEndpointStatuses(t *testing.T) { func TestEndpointStatuses(t *testing.T) {
defer storage.Get().Clear() defer store.Get().Clear()
defer cache.Clear() defer cache.Clear()
firstResult := &testSuccessfulResult firstResult := &testSuccessfulResult
secondResult := &testUnsuccessfulResult secondResult := &testUnsuccessfulResult
storage.Get().Insert(&testEndpoint, firstResult) store.Get().Insert(&testEndpoint, firstResult)
storage.Get().Insert(&testEndpoint, secondResult) store.Get().Insert(&testEndpoint, secondResult)
// Can't be bothered dealing with timezone issues on the worker that runs the automated tests // Can't be bothered dealing with timezone issues on the worker that runs the automated tests
firstResult.Timestamp = time.Time{} firstResult.Timestamp = time.Time{}
secondResult.Timestamp = time.Time{} secondResult.Timestamp = time.Time{}
@@ -175,43 +175,43 @@ func TestEndpointStatuses(t *testing.T) {
Name: "no-pagination", Name: "no-pagination",
Path: "/api/v1/endpoints/statuses", Path: "/api/v1/endpoints/statuses",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}]}]`,
}, },
{ {
Name: "pagination-first-result", Name: "pagination-first-result",
Path: "/api/v1/endpoints/statuses?page=1&pageSize=1", Path: "/api/v1/endpoints/statuses?page=1&pageSize=1",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}]}]`,
}, },
{ {
Name: "pagination-second-result", Name: "pagination-second-result",
Path: "/api/v1/endpoints/statuses?page=2&pageSize=1", Path: "/api/v1/endpoints/statuses?page=2&pageSize=1",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"}],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"}]}]`,
}, },
{ {
Name: "pagination-no-results", Name: "pagination-no-results",
Path: "/api/v1/endpoints/statuses?page=5&pageSize=20", Path: "/api/v1/endpoints/statuses?page=5&pageSize=20",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[]}]`,
}, },
{ {
Name: "invalid-pagination-should-fall-back-to-default", Name: "invalid-pagination-should-fall-back-to-default",
Path: "/api/v1/endpoints/statuses?page=INVALID&pageSize=INVALID", Path: "/api/v1/endpoints/statuses?page=INVALID&pageSize=INVALID",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}]}]`,
}, },
{ // XXX: Remove this in v4.0.0 { // XXX: Remove this in v4.0.0
Name: "backward-compatible-service-status", Name: "backward-compatible-service-status",
Path: "/api/v1/services/statuses", Path: "/api/v1/services/statuses",
ExpectedCode: http.StatusOK, ExpectedCode: http.StatusOK,
ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}],"events":[]}]`, ExpectedBody: `[{"name":"name","group":"group","key":"group_name","results":[{"status":200,"hostname":"example.org","duration":150000000,"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"0001-01-01T00:00:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"conditionResults":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"0001-01-01T00:00:00Z"}]}]`,
}, },
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
responseRecorder := httptest.NewRecorder() responseRecorder := httptest.NewRecorder()
router.ServeHTTP(responseRecorder, request) router.ServeHTTP(responseRecorder, request)
if responseRecorder.Code != scenario.ExpectedCode { if responseRecorder.Code != scenario.ExpectedCode {
+1 -1
View File
@@ -22,7 +22,7 @@ func TestFavIcon(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
responseRecorder := httptest.NewRecorder() responseRecorder := httptest.NewRecorder()
router.ServeHTTP(responseRecorder, request) router.ServeHTTP(responseRecorder, request)
if responseRecorder.Code != scenario.ExpectedCode { if responseRecorder.Code != scenario.ExpectedCode {
+1 -1
View File
@@ -44,7 +44,7 @@ func TestCreateRouter(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
if scenario.Gzip { if scenario.Gzip {
request.Header.Set("Accept-Encoding", "gzip") request.Header.Set("Accept-Encoding", "gzip")
} }
+3 -3
View File
@@ -8,12 +8,12 @@ import (
"github.com/TwiN/gatus/v3/config" "github.com/TwiN/gatus/v3/config"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/watchdog" "github.com/TwiN/gatus/v3/watchdog"
) )
func TestSinglePageApplication(t *testing.T) { func TestSinglePageApplication(t *testing.T) {
defer storage.Get().Clear() defer store.Get().Clear()
defer cache.Clear() defer cache.Clear()
cfg := &config.Config{ cfg := &config.Config{
Metrics: true, Metrics: true,
@@ -56,7 +56,7 @@ func TestSinglePageApplication(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) { t.Run(scenario.Name, func(t *testing.T) {
request, _ := http.NewRequest("GET", scenario.Path, nil) request, _ := http.NewRequest("GET", scenario.Path, http.NoBody)
if scenario.Gzip { if scenario.Gzip {
request.Header.Set("Accept-Encoding", "gzip") request.Header.Set("Accept-Encoding", "gzip")
} }
+1 -1
View File
@@ -54,7 +54,7 @@ func TestExtractPageAndPageSizeFromRequest(t *testing.T) {
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
t.Run("page-"+scenario.Page+"-pageSize-"+scenario.PageSize, func(t *testing.T) { t.Run("page-"+scenario.Page+"-pageSize-"+scenario.PageSize, func(t *testing.T) {
request, _ := http.NewRequest("GET", fmt.Sprintf("/api/v1/statuses?page=%s&pageSize=%s", scenario.Page, scenario.PageSize), nil) request, _ := http.NewRequest("GET", fmt.Sprintf("/api/v1/statuses?page=%s&pageSize=%s", scenario.Page, scenario.PageSize), http.NoBody)
actualPage, actualPageSize := extractPageAndPageSizeFromRequest(request) actualPage, actualPageSize := extractPageAndPageSizeFromRequest(request)
if actualPage != scenario.ExpectedPage { if actualPage != scenario.ExpectedPage {
t.Errorf("expected %d, got %d", scenario.ExpectedPage, actualPage) t.Errorf("expected %d, got %d", scenario.ExpectedPage, actualPage)
+2 -2
View File
@@ -80,7 +80,7 @@ const (
maximumLengthBeforeTruncatingWhenComparedWithPattern = 25 maximumLengthBeforeTruncatingWhenComparedWithPattern = 25
) )
// Condition is a condition that needs to be met in order for a Endpoint to be considered healthy. // Condition is a condition that needs to be met in order for an Endpoint to be considered healthy.
type Condition string type Condition string
// evaluate the Condition with the Result of the health check // evaluate the Condition with the Result of the health check
@@ -283,7 +283,7 @@ func prettifyNumericalParameters(parameters []string, resolvedParameters []int64
return prettify(parameters, []string{strconv.Itoa(int(resolvedParameters[0])), strconv.Itoa(int(resolvedParameters[1]))}, operator) return prettify(parameters, []string{strconv.Itoa(int(resolvedParameters[0])), strconv.Itoa(int(resolvedParameters[1]))}, operator)
} }
// XXX: make this configurable? i.e. show-resolved-conditions-on-failure // prettify returns a string representation of a condition with its parameters resolved between parentheses
func prettify(parameters []string, resolvedParameters []string, operator string) string { func prettify(parameters []string, resolvedParameters []string, operator string) string {
// Since, in the event of an invalid path, the resolvedParameters also contain the condition itself, // Since, in the event of an invalid path, the resolvedParameters also contain the condition itself,
// we'll return the resolvedParameters as-is. // we'll return the resolvedParameters as-is.
+5 -5
View File
@@ -79,19 +79,19 @@ type Endpoint struct {
Conditions []*Condition `yaml:"conditions"` Conditions []*Condition `yaml:"conditions"`
// Alerts is the alerting configuration for the endpoint in case of failure // Alerts is the alerting configuration for the endpoint in case of failure
Alerts []*alert.Alert `yaml:"alerts"` Alerts []*alert.Alert `yaml:"alerts,omitempty"`
// ClientConfig is the configuration of the client used to communicate with the endpoint's target // ClientConfig is the configuration of the client used to communicate with the endpoint's target
ClientConfig *client.Config `yaml:"client"` ClientConfig *client.Config `yaml:"client,omitempty"`
// UIConfig is the configuration for the UI // UIConfig is the configuration for the UI
UIConfig *ui.Config `yaml:"ui"` UIConfig *ui.Config `yaml:"ui,omitempty"`
// NumberOfFailuresInARow is the number of unsuccessful evaluations in a row // NumberOfFailuresInARow is the number of unsuccessful evaluations in a row
NumberOfFailuresInARow int NumberOfFailuresInARow int `yaml:"-"`
// NumberOfSuccessesInARow is the number of successful evaluations in a row // NumberOfSuccessesInARow is the number of successful evaluations in a row
NumberOfSuccessesInARow int NumberOfSuccessesInARow int `yaml:"-"`
} }
// IsEnabled returns whether the endpoint is enabled or not // IsEnabled returns whether the endpoint is enabled or not
+1 -1
View File
@@ -17,7 +17,7 @@ type EndpointStatus struct {
Results []*Result `json:"results"` Results []*Result `json:"results"`
// Events is a list of events // Events is a list of events
Events []*Event `json:"events"` Events []*Event `json:"events,omitempty"`
// Uptime information on the endpoint's uptime // Uptime information on the endpoint's uptime
// //
+2 -2
View File
@@ -13,7 +13,7 @@ type Result struct {
DNSRCode string `json:"-"` DNSRCode string `json:"-"`
// Hostname extracted from Endpoint.URL // Hostname extracted from Endpoint.URL
Hostname string `json:"hostname"` Hostname string `json:"hostname,omitempty"`
// IP resolved from the Endpoint URL // IP resolved from the Endpoint URL
IP string `json:"-"` IP string `json:"-"`
@@ -25,7 +25,7 @@ type Result struct {
Duration time.Duration `json:"duration"` Duration time.Duration `json:"duration"`
// Errors encountered during the evaluation of the Endpoint's health // Errors encountered during the evaluation of the Endpoint's health
Errors []string `json:"errors"` Errors []string `json:"errors,omitempty"`
// ConditionResults results of the Endpoint's conditions // ConditionResults results of the Endpoint's conditions
ConditionResults []*ConditionResult `json:"conditionResults"` ConditionResults []*ConditionResult `json:"conditionResults"`
+1 -1
View File
@@ -4,7 +4,7 @@ go 1.17
require ( require (
github.com/TwiN/gocache v1.2.4 github.com/TwiN/gocache v1.2.4
github.com/TwiN/health v1.0.1 github.com/TwiN/health v1.1.0
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/go-ping/ping v0.0.0-20210911151512-381826476871 github.com/go-ping/ping v0.0.0-20210911151512-381826476871
+2 -2
View File
@@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/TwiN/gocache v1.2.4 h1:AfJ1YRcxtQ/zZEN61URDwk/dwFG7LSRenU5qIm9dQzo= github.com/TwiN/gocache v1.2.4 h1:AfJ1YRcxtQ/zZEN61URDwk/dwFG7LSRenU5qIm9dQzo=
github.com/TwiN/gocache v1.2.4/go.mod h1:BjabsQQy6z5uHDorHa4LJVPEzFeitLIDbCtdv3gc1gA= github.com/TwiN/gocache v1.2.4/go.mod h1:BjabsQQy6z5uHDorHa4LJVPEzFeitLIDbCtdv3gc1gA=
github.com/TwiN/health v1.0.1 h1:Q8lE6mTMPG4A5nHXq5Xa+NY4Y8LkQdRBWh1ReUkuc6Y= github.com/TwiN/health v1.1.0 h1:IbXV4b5VPxzfIqOPiP/19JdBNFYM0oEDReLbUazhb2k=
github.com/TwiN/health v1.0.1/go.mod h1:Bt+lEvSi6C/9NWb7OoGmUmgtS4dfPeMM9EINnURv5dE= github.com/TwiN/health v1.1.0/go.mod h1:Bt+lEvSi6C/9NWb7OoGmUmgtS4dfPeMM9EINnURv5dE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+24 -3
View File
@@ -9,7 +9,7 @@ import (
"github.com/TwiN/gatus/v3/config" "github.com/TwiN/gatus/v3/config"
"github.com/TwiN/gatus/v3/controller" "github.com/TwiN/gatus/v3/controller"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/watchdog" "github.com/TwiN/gatus/v3/watchdog"
) )
@@ -18,6 +18,7 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
initializeStorage(cfg)
start(cfg) start(cfg)
// Wait for termination signal // Wait for termination signal
signalChannel := make(chan os.Signal, 1) signalChannel := make(chan os.Signal, 1)
@@ -46,8 +47,7 @@ func stop() {
} }
func save() { func save() {
err := storage.Get().Save() if err := store.Get().Save(); err != nil {
if err != nil {
log.Println("Failed to save storage provider:", err.Error()) log.Println("Failed to save storage provider:", err.Error())
} }
} }
@@ -62,6 +62,27 @@ func loadConfiguration() (cfg *config.Config, err error) {
return return
} }
// initializeStorage initializes the storage provider
//
// Q: "TwiN, why are you putting this here? Wouldn't it make more sense to have this in the config?!"
// A: Yes. Yes it would make more sense to have it in the config package. But I don't want to import
// the massive SQL dependencies just because I want to import the config, so here we are.
func initializeStorage(cfg *config.Config) {
err := store.Initialize(cfg.Storage)
if err != nil {
panic(err)
}
// Remove all EndpointStatus that represent endpoints which no longer exist in the configuration
var keys []string
for _, endpoint := range cfg.Endpoints {
keys = append(keys, endpoint.Key())
}
numberOfEndpointStatusesDeleted := store.Get().DeleteAllEndpointStatusesNotInKeys(keys)
if numberOfEndpointStatusesDeleted > 0 {
log.Printf("[config][validateStorageConfig] Deleted %d endpoint statuses because their matching endpoints no longer existed", numberOfEndpointStatusesDeleted)
}
}
func listenToConfigurationFileChanges(cfg *config.Config) { func listenToConfigurationFileChanges(cfg *config.Config) {
for { for {
time.Sleep(30 * time.Second) time.Sleep(30 * time.Second)
+46 -1
View File
@@ -1,14 +1,59 @@
package storage package storage
import (
"errors"
"log"
)
var (
ErrSQLStorageRequiresPath = errors.New("sql storage requires a non-empty path to be defined")
ErrMemoryStorageDoesNotSupportPath = errors.New("memory storage does not support persistence, use sqlite if you want persistence on file")
ErrCannotSetBothFileAndPath = errors.New("file has been deprecated in favor of path: you cannot set both of them")
)
// Config is the configuration for storage // Config is the configuration for storage
type Config struct { type Config struct {
// Path is the path used by the store to achieve persistence
// If blank, persistence is disabled.
// Note that not all Type support persistence
//
// XXX: Rename to path for v4.0.0
Path string `yaml:"path"`
// File is the path of the file to use for persistence // File is the path of the file to use for persistence
// If blank, persistence is disabled // If blank, persistence is disabled
// //
// XXX: Rename to path for v4.0.0 // Deprecated
File string `yaml:"file"` File string `yaml:"file"`
// Type of store // Type of store
// If blank, uses the default in-memory store // If blank, uses the default in-memory store
Type Type `yaml:"type"` Type Type `yaml:"type"`
} }
// ValidateAndSetDefaults validates the configuration and sets the default values (if applicable)
func (c *Config) ValidateAndSetDefaults() error {
if len(c.File) > 0 && len(c.Path) > 0 { // XXX: Remove for v4.0.0
return ErrCannotSetBothFileAndPath
} else if len(c.File) > 0 { // XXX: Remove for v4.0.0
log.Println("WARNING: Your configuration is using 'storage.file', which is deprecated in favor of 'storage.path'")
log.Println("WARNING: storage.file will be completely removed in v4.0.0, so please update your configuration")
log.Println("WARNING: See https://github.com/TwiN/gatus/issues/197")
c.Path = c.File
}
if c.Type == "" {
c.Type = TypeMemory
}
if (c.Type == TypePostgres || c.Type == TypeSQLite) && len(c.Path) == 0 {
return ErrSQLStorageRequiresPath
}
if c.Type == TypeMemory && len(c.Path) > 0 {
log.Println("WARNING: Your configuration is using a storage of type memory with persistence, which has been deprecated")
log.Println("WARNING: As of v4.0.0, the default storage type (memory) will not support persistence.")
log.Println("WARNING: If you want persistence, use 'storage.type: sqlite' instead of 'storage.type: memory'")
log.Println("WARNING: See https://github.com/TwiN/gatus/issues/198")
// XXX: Uncomment the following line for v4.0.0
//return ErrMemoryStorageDoesNotSupportPath
}
return nil
}
-91
View File
@@ -1,91 +0,0 @@
package storage
import (
"context"
"log"
"time"
"github.com/TwiN/gatus/v3/storage/store"
"github.com/TwiN/gatus/v3/storage/store/memory"
"github.com/TwiN/gatus/v3/storage/store/sql"
)
var (
provider store.Store
// initialized keeps track of whether the storage provider was initialized
// Because store.Store is an interface, a nil check wouldn't be sufficient, so instead of doing reflection
// every single time Get is called, we'll just lazily keep track of its existence through this variable
initialized bool
ctx context.Context
cancelFunc context.CancelFunc
)
// Get retrieves the storage provider
func Get() store.Store {
if !initialized {
log.Println("[storage][Get] Provider requested before it was initialized, automatically initializing")
err := Initialize(nil)
if err != nil {
panic("failed to automatically initialize store: " + err.Error())
}
}
return provider
}
// Initialize instantiates the storage provider based on the Config provider
func Initialize(cfg *Config) error {
initialized = true
var err error
if cancelFunc != nil {
// Stop the active autoSaveStore task, if there's already one
cancelFunc()
}
if cfg == nil {
cfg = &Config{}
}
if len(cfg.File) == 0 && cfg.Type != TypePostgres {
log.Printf("[storage][Initialize] Creating storage provider with type=%s and file=%s", cfg.Type, cfg.File)
} else {
log.Printf("[storage][Initialize] Creating storage provider with type=%s", cfg.Type)
}
ctx, cancelFunc = context.WithCancel(context.Background())
switch cfg.Type {
case TypeSQLite, TypePostgres:
provider, err = sql.NewStore(string(cfg.Type), cfg.File)
if err != nil {
return err
}
case TypeMemory:
fallthrough
default:
if len(cfg.File) > 0 {
provider, err = memory.NewStore(cfg.File)
if err != nil {
return err
}
go autoSaveStore(ctx, provider, 7*time.Minute)
} else {
provider, _ = memory.NewStore("")
}
}
return nil
}
// autoSaveStore automatically calls the Save function of the provider at every interval
func autoSaveStore(ctx context.Context, provider store.Store, interval time.Duration) {
for {
select {
case <-ctx.Done():
log.Printf("[storage][autoSaveStore] Stopping active job")
return
case <-time.After(interval):
log.Printf("[storage][autoSaveStore] Saving")
err := provider.Save()
if err != nil {
log.Println("[storage][autoSaveStore] Save failed:", err.Error())
}
}
}
}
-94
View File
@@ -1,94 +0,0 @@
package storage
import (
"testing"
"time"
"github.com/TwiN/gatus/v3/storage/store/sql"
)
func TestGet(t *testing.T) {
store := Get()
if store == nil {
t.Error("store should've been automatically initialized")
}
}
func TestInitialize(t *testing.T) {
type Scenario struct {
Name string
Cfg *Config
ExpectedErr error
}
scenarios := []Scenario{
{
Name: "nil",
Cfg: nil,
ExpectedErr: nil,
},
{
Name: "blank",
Cfg: &Config{},
ExpectedErr: nil,
},
{
Name: "memory-no-file",
Cfg: &Config{Type: TypeMemory},
ExpectedErr: nil,
},
{
Name: "memory-with-file",
Cfg: &Config{Type: TypeMemory, File: t.TempDir() + "/TestInitialize_memory-with-file.db"},
ExpectedErr: nil,
},
{
Name: "sqlite-no-file",
Cfg: &Config{Type: TypeSQLite},
ExpectedErr: sql.ErrFilePathNotSpecified,
},
{
Name: "sqlite-with-file",
Cfg: &Config{Type: TypeSQLite, File: t.TempDir() + "/TestInitialize_sqlite-with-file.db"},
ExpectedErr: nil,
},
}
for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) {
err := Initialize(scenario.Cfg)
if err != scenario.ExpectedErr {
t.Errorf("expected %v, got %v", scenario.ExpectedErr, err)
}
if err != nil {
return
}
if cancelFunc == nil {
t.Error("cancelFunc shouldn't have been nil")
}
if ctx == nil {
t.Error("ctx shouldn't have been nil")
}
if provider == nil {
t.Fatal("provider shouldn't have been nit")
}
provider.Close()
// Try to initialize it again
err = Initialize(scenario.Cfg)
if err != scenario.ExpectedErr {
t.Errorf("expected %v, got %v", scenario.ExpectedErr, err)
return
}
provider.Close()
})
}
}
func TestAutoSave(t *testing.T) {
file := t.TempDir() + "/TestAutoSave.db"
if err := Initialize(&Config{File: file}); err != nil {
t.Fatal("shouldn't have returned an error")
}
go autoSaveStore(ctx, provider, 3*time.Millisecond)
time.Sleep(15 * time.Millisecond)
cancelFunc()
time.Sleep(50 * time.Millisecond)
}
+23
View File
@@ -2,7 +2,11 @@ package memory
import ( import (
"encoding/gob" "encoding/gob"
"io/fs"
"io/ioutil"
"log"
"sort" "sort"
"strings"
"sync" "sync"
"time" "time"
@@ -24,6 +28,10 @@ func init() {
// Store that leverages gocache // Store that leverages gocache
type Store struct { type Store struct {
sync.RWMutex sync.RWMutex
// Deprecated
//
// File persistence will no longer be supported as of v4.0.0
// XXX: Remove me in v4.0.0
file string file string
cache *gocache.Cache cache *gocache.Cache
} }
@@ -37,9 +45,24 @@ func NewStore(file string) (*Store, error) {
file: file, file: file,
cache: gocache.NewCache().WithMaxSize(gocache.NoMaxSize), cache: gocache.NewCache().WithMaxSize(gocache.NoMaxSize),
} }
// XXX: Remove the block below in v4.0.0 because persistence with the memory store will no longer be supported
// XXX: Make sure to also update gocache to v2.0.0
if len(file) > 0 { if len(file) > 0 {
_, err := store.cache.ReadFromFile(file) _, err := store.cache.ReadFromFile(file)
if err != nil { if err != nil {
// XXX: Remove the block below in v4.0.0
if data, err2 := ioutil.ReadFile(file); err2 == nil {
isFromOldVersion := strings.Contains(string(data), "*core.ServiceStatus")
if isFromOldVersion {
log.Println("WARNING: Couldn't read file due to recent change in v3.3.0, see https://github.com/TwiN/gatus/issues/191")
log.Println("WARNING: Will automatically rename old file to " + file + ".old and overwrite the current file")
if err = ioutil.WriteFile(file+".old", data, fs.ModePerm); err != nil {
log.Println("WARNING: Tried my best to keep the old file, but it wasn't enough. Sorry, your file will be overwritten :(")
}
// Return the store regardless of whether there was an error or not
return store, nil
}
}
return nil, err return nil, err
} }
} }
+7 -13
View File
@@ -34,8 +34,8 @@ const (
) )
var ( var (
// ErrFilePathNotSpecified is the error returned when path parameter passed in NewStore is blank // ErrPathNotSpecified is the error returned when the path parameter passed in NewStore is blank
ErrFilePathNotSpecified = errors.New("file path cannot be empty") ErrPathNotSpecified = errors.New("path cannot be empty")
// ErrDatabaseDriverNotSpecified is the error returned when the driver parameter passed in NewStore is blank // ErrDatabaseDriverNotSpecified is the error returned when the driver parameter passed in NewStore is blank
ErrDatabaseDriverNotSpecified = errors.New("database driver cannot be empty") ErrDatabaseDriverNotSpecified = errors.New("database driver cannot be empty")
@@ -45,20 +45,20 @@ var (
// Store that leverages a database // Store that leverages a database
type Store struct { type Store struct {
driver, file string driver, path string
db *sql.DB db *sql.DB
} }
// NewStore initializes the database and creates the schema if it doesn't already exist in the file specified // NewStore initializes the database and creates the schema if it doesn't already exist in the path specified
func NewStore(driver, path string) (*Store, error) { func NewStore(driver, path string) (*Store, error) {
if len(driver) == 0 { if len(driver) == 0 {
return nil, ErrDatabaseDriverNotSpecified return nil, ErrDatabaseDriverNotSpecified
} }
if len(path) == 0 { if len(path) == 0 {
return nil, ErrFilePathNotSpecified return nil, ErrPathNotSpecified
} }
store := &Store{driver: driver, file: path} store := &Store{driver: driver, path: path}
var err error var err error
if store.db, err = sql.Open(driver, path); err != nil { if store.db, err = sql.Open(driver, path); err != nil {
return nil, err return nil, err
@@ -342,7 +342,7 @@ func (s *Store) DeleteAllEndpointStatusesNotInKeys(keys []string) int {
query += fmt.Sprintf("$%d,", i+1) query += fmt.Sprintf("$%d,", i+1)
args = append(args, keys[i]) args = append(args, keys[i])
} }
query = query[:len(query)-1] + ")" // Remove the last comma and close the parenthesis query = query[:len(query)-1] + ")" // Remove the last comma and add the closing parenthesis
result, err = s.db.Exec(query, args...) result, err = s.db.Exec(query, args...)
} }
if err != nil { if err != nil {
@@ -493,12 +493,6 @@ func (s *Store) getEndpointStatusByKey(tx *sql.Tx, key string, parameters *pagin
log.Printf("[sql][getEndpointStatusByKey] Failed to retrieve results for key=%s: %s", key, err.Error()) log.Printf("[sql][getEndpointStatusByKey] Failed to retrieve results for key=%s: %s", key, err.Error())
} }
} }
//if parameters.IncludeUptime {
// now := time.Now()
// endpointStatus.Uptime.LastHour, _, err = s.getEndpointUptime(tx, endpointID, now.Add(-time.Hour), now)
// endpointStatus.Uptime.LastTwentyFourHours, _, err = s.getEndpointUptime(tx, endpointID, now.Add(-24*time.Hour), now)
// endpointStatus.Uptime.LastSevenDays, _, err = s.getEndpointUptime(tx, endpointID, now.Add(-7*24*time.Hour), now)
//}
return endpointStatus, nil return endpointStatus, nil
} }
+4 -4
View File
@@ -84,7 +84,7 @@ func TestNewStore(t *testing.T) {
if _, err := NewStore("", "TestNewStore.db"); err != ErrDatabaseDriverNotSpecified { if _, err := NewStore("", "TestNewStore.db"); err != ErrDatabaseDriverNotSpecified {
t.Error("expected error due to blank driver parameter") t.Error("expected error due to blank driver parameter")
} }
if _, err := NewStore("sqlite", ""); err != ErrFilePathNotSpecified { if _, err := NewStore("sqlite", ""); err != ErrPathNotSpecified {
t.Error("expected error due to blank path parameter") t.Error("expected error due to blank path parameter")
} }
if store, err := NewStore("sqlite", t.TempDir()+"/TestNewStore.db"); err != nil { if store, err := NewStore("sqlite", t.TempDir()+"/TestNewStore.db"); err != nil {
@@ -169,8 +169,8 @@ func TestStore_InsertCleansUpEventsAndResultsProperly(t *testing.T) {
} }
func TestStore_Persistence(t *testing.T) { func TestStore_Persistence(t *testing.T) {
file := t.TempDir() + "/TestStore_Persistence.db" path := t.TempDir() + "/TestStore_Persistence.db"
store, _ := NewStore("sqlite", file) store, _ := NewStore("sqlite", path)
store.Insert(&testEndpoint, &testSuccessfulResult) store.Insert(&testEndpoint, &testSuccessfulResult)
store.Insert(&testEndpoint, &testUnsuccessfulResult) store.Insert(&testEndpoint, &testUnsuccessfulResult)
if uptime, _ := store.GetUptimeByKey(testEndpoint.Key(), time.Now().Add(-time.Hour), time.Now()); uptime != 0.5 { if uptime, _ := store.GetUptimeByKey(testEndpoint.Key(), time.Now().Add(-time.Hour), time.Now()); uptime != 0.5 {
@@ -188,7 +188,7 @@ func TestStore_Persistence(t *testing.T) {
t.Fatal("sanity check failed") t.Fatal("sanity check failed")
} }
store.Close() store.Close()
store, _ = NewStore("sqlite", file) store, _ = NewStore("sqlite", path)
defer store.Close() defer store.Close()
ssFromNewStore, _ := store.GetEndpointStatus(testEndpoint.Group, testEndpoint.Name, paging.NewEndpointStatusParams().WithResults(1, common.MaximumNumberOfResults).WithEvents(1, common.MaximumNumberOfEvents)) ssFromNewStore, _ := store.GetEndpointStatus(testEndpoint.Group, testEndpoint.Name, paging.NewEndpointStatusParams().WithResults(1, common.MaximumNumberOfResults).WithEvents(1, common.MaximumNumberOfEvents))
if ssFromNewStore == nil || ssFromNewStore.Group != "group" || ssFromNewStore.Name != "name" || len(ssFromNewStore.Events) != 3 || len(ssFromNewStore.Results) != 2 { if ssFromNewStore == nil || ssFromNewStore.Group != "group" || ssFromNewStore.Name != "name" || len(ssFromNewStore.Events) != 3 || len(ssFromNewStore.Results) != 2 {
+83
View File
@@ -1,9 +1,12 @@
package store package store
import ( import (
"context"
"log"
"time" "time"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage"
"github.com/TwiN/gatus/v3/storage/store/common/paging" "github.com/TwiN/gatus/v3/storage/store/common/paging"
"github.com/TwiN/gatus/v3/storage/store/memory" "github.com/TwiN/gatus/v3/storage/store/memory"
"github.com/TwiN/gatus/v3/storage/store/sql" "github.com/TwiN/gatus/v3/storage/store/sql"
@@ -56,3 +59,83 @@ var (
_ Store = (*memory.Store)(nil) _ Store = (*memory.Store)(nil)
_ Store = (*sql.Store)(nil) _ Store = (*sql.Store)(nil)
) )
var (
store Store
// initialized keeps track of whether the storage provider was initialized
// Because store.Store is an interface, a nil check wouldn't be sufficient, so instead of doing reflection
// every single time Get is called, we'll just lazily keep track of its existence through this variable
initialized bool
ctx context.Context
cancelFunc context.CancelFunc
)
func Get() Store {
if !initialized {
// This only happens in tests
log.Println("[store][Get] Provider requested before it was initialized, automatically initializing")
err := Initialize(nil)
if err != nil {
panic("failed to automatically initialize store: " + err.Error())
}
}
return store
}
// Initialize instantiates the storage provider based on the Config provider
func Initialize(cfg *storage.Config) error {
initialized = true
var err error
if cancelFunc != nil {
// Stop the active autoSave task, if there's already one
cancelFunc()
}
if cfg == nil {
// This only happens in tests
log.Println("[store][Initialize] nil storage config passed as parameter. This should only happen in tests. Defaulting to an empty config.")
cfg = &storage.Config{}
}
if len(cfg.Path) == 0 && cfg.Type != storage.TypePostgres {
log.Printf("[store][Initialize] Creating storage provider of type=%s", cfg.Type)
}
ctx, cancelFunc = context.WithCancel(context.Background())
switch cfg.Type {
case storage.TypeSQLite, storage.TypePostgres:
store, err = sql.NewStore(string(cfg.Type), cfg.Path)
if err != nil {
return err
}
case storage.TypeMemory:
fallthrough
default:
if len(cfg.Path) > 0 {
store, err = memory.NewStore(cfg.Path)
if err != nil {
return err
}
go autoSave(ctx, store, 7*time.Minute)
} else {
store, _ = memory.NewStore("")
}
}
return nil
}
// autoSave automatically calls the Save function of the provider at every interval
func autoSave(ctx context.Context, store Store, interval time.Duration) {
for {
select {
case <-ctx.Done():
log.Printf("[store][autoSave] Stopping active job")
return
case <-time.After(interval):
log.Printf("[store][autoSave] Saving")
err := store.Save()
if err != nil {
log.Println("[store][autoSave] Save failed:", err.Error())
}
}
}
}
+87
View File
@@ -5,6 +5,7 @@ import (
"time" "time"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/storage"
"github.com/TwiN/gatus/v3/storage/store/common" "github.com/TwiN/gatus/v3/storage/store/common"
"github.com/TwiN/gatus/v3/storage/store/common/paging" "github.com/TwiN/gatus/v3/storage/store/common/paging"
"github.com/TwiN/gatus/v3/storage/store/memory" "github.com/TwiN/gatus/v3/storage/store/memory"
@@ -520,3 +521,89 @@ func TestStore_DeleteAllEndpointStatusesNotInKeys(t *testing.T) {
}) })
} }
} }
func TestGet(t *testing.T) {
store := Get()
if store == nil {
t.Error("store should've been automatically initialized")
}
}
func TestInitialize(t *testing.T) {
type Scenario struct {
Name string
Cfg *storage.Config
ExpectedErr error
}
scenarios := []Scenario{
{
Name: "nil",
Cfg: nil,
ExpectedErr: nil,
},
{
Name: "blank",
Cfg: &storage.Config{},
ExpectedErr: nil,
},
{
Name: "memory-no-path",
Cfg: &storage.Config{Type: storage.TypeMemory},
ExpectedErr: nil,
},
{ // XXX: Remove for v4.0.0. See https://github.com/TwiN/gatus/issues/198
Name: "memory-with-path",
Cfg: &storage.Config{Type: storage.TypeMemory, Path: t.TempDir() + "/TestInitialize_memory-with-path.db"},
ExpectedErr: nil,
},
{
Name: "sqlite-no-path",
Cfg: &storage.Config{Type: storage.TypeSQLite},
ExpectedErr: sql.ErrPathNotSpecified,
},
{
Name: "sqlite-with-path",
Cfg: &storage.Config{Type: storage.TypeSQLite, Path: t.TempDir() + "/TestInitialize_sqlite-with-path.db"},
ExpectedErr: nil,
},
}
for _, scenario := range scenarios {
t.Run(scenario.Name, func(t *testing.T) {
err := Initialize(scenario.Cfg)
if err != scenario.ExpectedErr {
t.Errorf("expected %v, got %v", scenario.ExpectedErr, err)
}
if err != nil {
return
}
if cancelFunc == nil {
t.Error("cancelFunc shouldn't have been nil")
}
if ctx == nil {
t.Error("ctx shouldn't have been nil")
}
if store == nil {
t.Fatal("provider shouldn't have been nit")
}
store.Close()
// Try to initialize it again
err = Initialize(scenario.Cfg)
if err != scenario.ExpectedErr {
t.Errorf("expected %v, got %v", scenario.ExpectedErr, err)
return
}
store.Close()
})
}
}
func TestAutoSave(t *testing.T) {
file := t.TempDir() + "/TestAutoSave.db"
if err := Initialize(&storage.Config{Path: file}); err != nil {
t.Fatal("shouldn't have returned an error")
}
go autoSave(ctx, store, 3*time.Millisecond)
time.Sleep(15 * time.Millisecond)
cancelFunc()
time.Sleep(50 * time.Millisecond)
}
+2
View File
@@ -0,0 +1,2 @@
bench:
go test -bench . -race
+35 -12
View File
@@ -1,6 +1,9 @@
package health package health
import "net/http" import (
"net/http"
"sync"
)
var ( var (
handler = &healthHandler{ handler = &healthHandler{
@@ -13,6 +16,8 @@ var (
type healthHandler struct { type healthHandler struct {
useJSON bool useJSON bool
status Status status Status
sync.RWMutex
} }
// WithJSON configures whether the handler should output a response in JSON or in raw text // WithJSON configures whether the handler should output a response in JSON or in raw text
@@ -24,30 +29,48 @@ func (h *healthHandler) WithJSON(v bool) *healthHandler {
} }
// ServeHTTP serves the HTTP request for the health handler // ServeHTTP serves the HTTP request for the health handler
func (h healthHandler) ServeHTTP(writer http.ResponseWriter, _ *http.Request) { func (h *healthHandler) ServeHTTP(writer http.ResponseWriter, _ *http.Request) {
var status int var statusCode int
var body []byte var body []byte
if h.status == Up { handlerStatus := h.getStatus()
status = http.StatusOK if handlerStatus == Up {
statusCode = http.StatusOK
} else { } else {
status = http.StatusInternalServerError statusCode = http.StatusInternalServerError
} }
if h.useJSON { if h.useJSON {
writer.Header().Set("Content-Type", "application/json") writer.Header().Set("Content-Type", "application/json")
body = []byte(`{"status":"` + h.status + `"}`) body = []byte(`{"status":"` + handlerStatus + `"}`)
} else { } else {
body = []byte(h.status) body = []byte(handlerStatus)
} }
writer.WriteHeader(status) writer.WriteHeader(statusCode)
_, _ = writer.Write(body) _, _ = writer.Write(body)
} }
func (h *healthHandler) getStatus() Status {
h.Lock()
defer h.Unlock()
return h.status
}
func (h *healthHandler) setStatus(status Status) {
h.Lock()
h.status = status
h.Unlock()
}
// Handler retrieves the health handler // Handler retrieves the health handler
func Handler() *healthHandler { func Handler() *healthHandler {
return handler return handler
} }
// SetStatus sets the status to be reflected by the health handler // GetStatus retrieves the current status returned by the health handler
func SetStatus(status Status) { func GetStatus() Status {
handler.status = status return handler.getStatus()
}
// SetStatus sets the status to be returned by the health handler
func SetStatus(status Status) {
handler.setStatus(status)
} }
+1 -1
View File
@@ -1,7 +1,7 @@
# github.com/TwiN/gocache v1.2.4 # github.com/TwiN/gocache v1.2.4
## explicit; go 1.16 ## explicit; go 1.16
github.com/TwiN/gocache github.com/TwiN/gocache
# github.com/TwiN/health v1.0.1 # github.com/TwiN/health v1.1.0
## explicit; go 1.17 ## explicit; go 1.17
github.com/TwiN/health github.com/TwiN/health
# github.com/beorn7/perks v1.0.1 # github.com/beorn7/perks v1.0.1
+4 -4
View File
@@ -11,7 +11,7 @@ import (
"github.com/TwiN/gatus/v3/config/maintenance" "github.com/TwiN/gatus/v3/config/maintenance"
"github.com/TwiN/gatus/v3/core" "github.com/TwiN/gatus/v3/core"
"github.com/TwiN/gatus/v3/metric" "github.com/TwiN/gatus/v3/metric"
"github.com/TwiN/gatus/v3/storage" "github.com/TwiN/gatus/v3/storage/store"
) )
var ( var (
@@ -29,13 +29,13 @@ func Monitor(cfg *config.Config) {
for _, endpoint := range cfg.Endpoints { for _, endpoint := range cfg.Endpoints {
if endpoint.IsEnabled() { if endpoint.IsEnabled() {
// To prevent multiple requests from running at the same time, we'll wait for a little before each iteration // To prevent multiple requests from running at the same time, we'll wait for a little before each iteration
time.Sleep(1111 * time.Millisecond) time.Sleep(777 * time.Millisecond)
go monitor(endpoint, cfg.Alerting, cfg.Maintenance, cfg.DisableMonitoringLock, cfg.Metrics, cfg.Debug, ctx) go monitor(endpoint, cfg.Alerting, cfg.Maintenance, cfg.DisableMonitoringLock, cfg.Metrics, cfg.Debug, ctx)
} }
} }
} }
// monitor monitors a single endpoint in a loop // monitor a single endpoint in a loop
func monitor(endpoint *core.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, disableMonitoringLock, enabledMetrics, debug bool, ctx context.Context) { func monitor(endpoint *core.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, disableMonitoringLock, enabledMetrics, debug bool, ctx context.Context) {
// Run it immediately on start // Run it immediately on start
execute(endpoint, alertingConfig, maintenanceConfig, disableMonitoringLock, enabledMetrics, debug) execute(endpoint, alertingConfig, maintenanceConfig, disableMonitoringLock, enabledMetrics, debug)
@@ -88,7 +88,7 @@ func execute(endpoint *core.Endpoint, alertingConfig *alerting.Config, maintenan
// UpdateEndpointStatuses updates the slice of endpoint statuses // UpdateEndpointStatuses updates the slice of endpoint statuses
func UpdateEndpointStatuses(endpoint *core.Endpoint, result *core.Result) { func UpdateEndpointStatuses(endpoint *core.Endpoint, result *core.Result) {
if err := storage.Get().Insert(endpoint, result); err != nil { if err := store.Get().Insert(endpoint, result); err != nil {
log.Println("[watchdog][UpdateEndpointStatuses] Failed to insert data in storage:", err.Error()) log.Println("[watchdog][UpdateEndpointStatuses] Failed to insert data in storage:", err.Error())
} }
} }
+1991 -3315
View File
File diff suppressed because it is too large. Load diff
+10 -10
View File
@@ -1,6 +1,6 @@
{ {
"name": "gatus", "name": "gatus",
"version": "3.2.2", "version": "3.3.3",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --mode development", "serve": "vue-cli-service serve --mode development",
@@ -8,22 +8,22 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"core-js": "^3.17.3", "core-js": "^3.19.1",
"vue": "^3.2.11", "vue": "3.2.21",
"vue-router": "^4.0.11" "vue-router": "^4.0.11"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^5.0.0-beta.3", "@vue/cli-plugin-babel": "5.0.0-beta.6",
"@vue/cli-plugin-eslint": "^5.0.0-beta.3", "@vue/cli-plugin-eslint": "5.0.0-beta.6",
"@vue/cli-plugin-router": "^5.0.0-beta.3", "@vue/cli-plugin-router": "5.0.0-beta.6",
"@vue/cli-service": "^5.0.0-beta.3", "@vue/cli-service": "5.0.0-beta.6",
"@vue/compiler-sfc": "^3.2.11", "@vue/compiler-sfc": "3.2.21",
"autoprefixer": "^10.3.4", "autoprefixer": "10.4.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-vue": "^7.17.0", "eslint-plugin-vue": "^7.17.0",
"postcss": "^8.3.6", "postcss": "^8.3.6",
"tailwindcss": "^2.2.15" "tailwindcss": "^2.2.19"
}, },
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
+1 -3
View File
@@ -3,9 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<script type="text/javascript"> <script type="text/javascript">
window.config = { window.config = {logo: "{{ .Logo }}"};
logo: "{{ .Logo }}"
};
</script> </script>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
+1 -1
View File
@@ -7,7 +7,7 @@
</div> </div>
<div class="w-1/4 flex justify-end"> <div class="w-1/4 flex justify-end">
<img v-if="getLogo" :src="getLogo" alt="Gatus" class="object-scale-down" style="max-width: 100px; min-width: 50px; min-height:50px;"/> <img v-if="getLogo" :src="getLogo" alt="Gatus" class="object-scale-down" style="max-width: 100px; min-width: 50px; min-height:50px;"/>
<img v-if="!getLogo" src="./assets/logo.png" alt="Gatus" class="object-scale-down" style="max-width: 100px; min-width: 50px; min-height:50px;"/> <img v-else src="./assets/logo.png" alt="Gatus" class="object-scale-down" style="max-width: 100px; min-width: 50px; min-height:50px;"/>
</div> </div>
</div> </div>
</div> </div>
+5 -1
View File
@@ -2,7 +2,11 @@ export const helper = {
methods: { methods: {
generatePrettyTimeAgo(t) { generatePrettyTimeAgo(t) {
let differenceInMs = new Date().getTime() - new Date(t).getTime(); let differenceInMs = new Date().getTime() - new Date(t).getTime();
if (differenceInMs > 3600000) { if (differenceInMs > 3*86400000) { // If it was more than 3 days ago, we'll display the number of days ago
let days = (differenceInMs / 86400000).toFixed(0);
return days + " day" + (days !== "1" ? "s" : "") + " ago";
}
if (differenceInMs > 3600000) { // If it was more than 1h ago, display the number of hours ago
let hours = (differenceInMs / 3600000).toFixed(0); let hours = (differenceInMs / 3600000).toFixed(0);
return hours + " hour" + (hours !== "1" ? "s" : "") + " ago"; return hours + " hour" + (hours !== "1" ? "s" : "") + " ago";
} }
+2 -2
View File
@@ -1,5 +1,5 @@
#social[data-v-a88161aa]{position:fixed;right:5px;bottom:5px;padding:5px;margin:0;z-index:100}#social img[data-v-a88161aa]{opacity:.3}#social img[data-v-a88161aa]:hover{opacity:1}#tooltip{position:fixed;background-color:#fff;border:1px solid #d3d3d3;border-radius:4px;padding:6px;font-size:13px}#tooltip code{color:#212529;line-height:1}#tooltip .tooltip-title{font-weight:700;margin-bottom:0;display:block;margin-top:8px}#tooltip>.tooltip-title:first-child{margin-top:0} #social[data-v-a88161aa]{position:fixed;right:5px;bottom:5px;padding:5px;margin:0;z-index:100}#social img[data-v-a88161aa]{opacity:.3}#social img[data-v-a88161aa]:hover{opacity:1}#tooltip{position:fixed;background-color:#fff;border:1px solid #d3d3d3;border-radius:4px;padding:6px;font-size:13px}#tooltip code{color:#212529;line-height:1}#tooltip .tooltip-title{font-weight:700;margin-bottom:0;display:block;margin-top:8px}#tooltip>.tooltip-title:first-child{margin-top:0}
/*! tailwindcss v2.2.16 | MIT License | https://tailwindcss.com */ /*! tailwindcss v2.2.19 | MIT License | https://tailwindcss.com */
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */html{-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}html{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{font-family:inherit;line-height:inherit}*,:after,:before{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder,textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:Consolas,Monaco,Courier New,monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:after,:before{--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.invisible{visibility:hidden}.absolute{position:absolute}.relative{position:relative}.top-2{top:.5rem}.bottom-2{bottom:.5rem}.left-2{left:.5rem}.float-right{float:right}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.my-auto{margin-top:auto;margin-bottom:auto}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-12{margin-top:3rem}.mr-2{margin-right:.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-10{margin-bottom:2.5rem}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.table{display:table}.hidden{display:none}.w-1\/2{width:50%}.w-1\/4{width:25%}.w-3\/4{width:75%}.flex-1{flex:1 1 0%}@-webkit-keyframes spin{to{transform:rotate(1turn)}}@keyframes spin{to{transform:rotate(1turn)}}@-webkit-keyframes ping{75%,to{transform:scale(2);opacity:0}}@keyframes ping{75%,to{transform:scale(2);opacity:0}}@-webkit-keyframes pulse{50%{opacity:.5}}@keyframes pulse{50%{opacity:.5}}@-webkit-keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.justify-end{justify-content:flex-end}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)))}.overflow-x-hidden{overflow-x:hidden}.rounded-none{border-radius:0}.rounded{border-radius:.25rem}.rounded-xl{border-radius:.75rem}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-t{border-top-width:1px}.border-r{border-right-width:1px}.border-l{border-left-width:1px}.border-dashed{border-style:dashed}.border-gray-200{Line truncated /*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */html{-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}html{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{font-family:inherit;line-height:inherit}*,:after,:before{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder,textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:Consolas,Monaco,Courier New,monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:after,:before{--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.invisible{visibility:hidden}.absolute{position:absolute}.relative{position:relative}.top-2{top:.5rem}.bottom-2{bottom:.5rem}.left-2{left:.5rem}.float-right{float:right}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.my-auto{margin-top:auto;margin-bottom:auto}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-12{margin-top:3rem}.mr-2{margin-right:.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-10{margin-bottom:2.5rem}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.table{display:table}.hidden{display:none}.w-1\/2{width:50%}.w-1\/4{width:25%}.w-3\/4{width:75%}.flex-1{flex:1 1 0%}@-webkit-keyframes spin{to{transform:rotate(1turn)}}@keyframes spin{to{transform:rotate(1turn)}}@-webkit-keyframes ping{75%,to{transform:scale(2);opacity:0}}@keyframes ping{75%,to{transform:scale(2);opacity:0}}@-webkit-keyframes pulse{50%{opacity:.5}}@keyframes pulse{50%{opacity:.5}}@-webkit-keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.justify-end{justify-content:flex-end}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)))}.overflow-x-hidden{overflow-x:hidden}.rounded-none{border-radius:0}.rounded{border-radius:.25rem}.rounded-xl{border-radius:.75rem}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-t{border-top-width:1px}.border-r{border-right-width:1px}.border-l{border-left-width:1px}.border-dashed{border-style:dashed}.border-gray-200{Line truncated
+1 -3
View File
@@ -1,3 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script>window.config = { <!doctype html><html lang="en"><head><meta charset="utf-8"/><script>window.config = {logo: "{{ .Logo }}"};</script><title>{{ .Title }}</title><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><script defer="defer" type="module" src="/js/chunk-vendors.js"></script><script defer="defer" type="module" src="/js/app.js"></script><link href="/css/app.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.js" nomodule></script><script defer="defer" src="/js/app-legacy.js" nomodule></script></head><body class="dark:bg-gray-900"><noscript><strong>Enable JavaScript to view this page.</strong></noscript><div id="app"></div></body></html>
logo: "{{ .Logo }}"
};</script><title>{{ .Title }}</title><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><script defer="defer" src="/js/chunk-vendors.js" type="module"></script><script defer="defer" src="/js/app.js" type="module"></script><link href="/css/app.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.js" nomodule></script><script defer="defer" src="/js/app-legacy.js" nomodule></script></head><body class="dark:bg-gray-900"><noscript><strong>Enable JavaScript to view this page.</strong></noscript><div id="app"></div></body></html>
+1 -1
View File
@@ -1 +1 @@
(function(){"use strict";var e={2119:function(e,t,n){n.d(t,{L:function(){return Ft}});n(6992),n(8674),n(9601),n(7727);var s=n(9963),o=n(6252),r=n.p+"img/logo.png",a={class:"container container-xs relative mx-auto xl:rounded xl:border xl:shadow-xl xl:my-5 p-5 pb-12 xl:pb-5 text-left dark:bg-gray-800 dark:text-gray-200 dark:border-gray-500",id:"global"},i={class:"mb-2"},l={class:"flex flex-wrap"},u=(0,o._)("div",{class:"w-3/4 text-left my-auto"},[(0,o._)("div",{class:"text-3xl xl:text-5xl lg:text-4xl font-light"},"Health Status")],-1),g={class:"w-1/4 flex justify-end"},c=["src"],d={key:1,src:r,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}};function h(e,t,n,s,r,h){var p=(0,o.up)("router-view"),f=(0,o.up)("Tooltip"),m=(0,o.up)("Social");return(0,o.wg)(),(0,o.iD)(o.HY,null,[(0,o._)("div",a,[(0,o._)("div",i,[(0,o._)("div",l,[u,(0,o._)("div",g,[h.getLogo?((0,o.wg)(),(0,o.iD)("img",{key:0,src:h.getLogo,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}},null,8,c)):(0,o.kq)("",!0),h.getLogo?(0,o.kq)("",!0):((0,o.wg)(),(0,o.iD)("img",d))])])]),(0,o.Wm)(p,{onShowTooltip:h.showTooltip},null,8,["onShowTooltip"])]),(0,o.Wm)(f,{result:r.tooltip.result,event:r.tooltip.event},null,8,["result","event"]),(0,o.Wm)(m)],64)}var p=n.p+"img/github.png",f=function(e){return(0,o.dD)("data-v-a88161aa"),e=e(),(0,o.Cn)(),e},m={id:"social"},A=f((function(){return(0,o._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,o._)("img",{src:p,alt:"GitHub",width:"32",height:"auto"})],-1)})),v=[A];function w(e,t,n,s,r,a){return(0,o.wg)(),(0,o.iD)("div",m,v)}var y={name:"Social"},x=n(3744);const T=(0,x.Z)(y,[["render",w],["__scopeId","data-v-a88161aa"]]);var k=T,I=(n(6977),n(3577)),b=(0,o._)("div",{class:"tooltip-title"},"Timestamp:",-1),R={id:"tooltip-timestamp"},D=(0,o._)("div",{class:"tooltip-title"},"Response time:",-1),S={id:"tooltip-response-time"},C=(0,o._)("div",{class:"tooltip-title"},"Conditions:",-1),B={id:"tooltip-conditions"},E=(0,o._)("br",null,null,-1),P={key:0,id:"tooltip-errors-container"},H=(0,o._)("div",{class:"tooltip-title"},"Errors:",-1),O={id:"tooltip-errors"},U=(0,o._)("br",null,null,-1);function z(e,t,n,s,r,a){return(0,o.wg)(),(0,o.iD)("div",{id:"tooltip",ref:"tooltip",class:(0,I.C_)(r.hidden?"invisible":""),style:(0,I.j5)("top:"+r.top+"px; left:"+r.left+"px")},[n.result?(0,o.WI)(e.$slots,"default",{key:0},(function(){return[b,(0,o._)("code",R,(0,I.zw)(a.prettifyTimestamp(n.result.timestamp)),1),D,(0,o._)("code",S,(0,I.zw)((n.result.duration/1e6).toFixed(0))+"ms",1),C,(0,o._)("code",B,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(n.result.conditionResults,(function(t){return(0,o.WI)(e.$slots,"default",{key:t},(function(){return[(0,o.Uk)((0,I.zw)(t.success?"✓":"X")+" ~ "+(0,I.zw)(t.condition),1),E]}))})),128))]),n.result.errors&&n.result.errors.length?((0,o.wg)(),(0,o.iD)("div",P,[H,(0,o._)("code",O,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(n.result.errors,(function(t){return(0,o.WI)(e.$slots,"default",{key:t},(function(){return[(0,o.Uk)(" - "+(0,I.zw)(t),1),U]}))})),128))])])):(0,o.kq)("",!0)]})):(0,o.kq)("",!0)],6)}n(4916),n(5306);var M={name:"Endpoints",props:{event:Event,result:Object},methods:{prettifyTimestamp:function(e){var t=new Date(e),n=t.getFullYear(),s=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),o=(t.getDate()<10?"0":"")+t.getDate(),r=(t.getHours()<10?"0":"")+t.getHours(),a=(t.getMinutes()<10?"0":"")+t.getMinutes(),i=(t.getSeconds()<10?"0":"")+t.getSeconds();return n+"-"+s+"-"+o+" "+r+":"+a+":"+i},htmlEntities:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},reposition:function(){if(this.event&&this.event.type)if("mouseenter"===this.event.type){var e=this.event.target.getBoundingClientRect().y+30,t=this.event.target.getBoundingClientRect().x,n=this.$refs.tooltip.getBoundingClientRect();t+window.scrollX+n.width+50>document.body.getBoundingClientRect().width&&(t=this.event.target.getBoundingClientRect().x-n.width+this.event.target.getBoundingClientRect().width,t<0&&(t+=-t)),e+window.scrollY+n.height+50>document.body.getBoundingClientRect().height&&e>=0&&(e=this.event.target.getBoundingClientRect().y-(n.height+10),e<0&&(e=this.event.target.getBoundingClientRect().y+30)),this.top=e,this.left=t}else"mouseleave"===this.event.type&&(this.hidden=!0)}},watch:{event:function(e){e&&e.type&&("mouseenter"===e.type?this.hidden=!1:"mouseleave"===e.type&&(this.hidden=!0))}},updated:function(){this.reposition()},created:function(){this.reposition()},data:function(){return{hidden:!0,top:0,left:0}}};const Q=(0,x.Z)(M,[["render",z]]);var W=Q,X={name:"App",components:{Social:k,Tooltip:W},methods:{showTooltip:function(e,t){this.tooltip={result:e,event:t}}},computed:{getLogo:function(){return window.config&&window.config.logo&&"{{ .Logo }}"!==window.config.logo?window.config.logo:""}},data:funcLine truncated (function(){"use strict";var e={5804:function(e,t,n){n.d(t,{L:function(){return qt}});n(6992),n(8674),n(9601),n(7727);var s=n(9963),o=n(6252),r=n.p+"img/logo.png",a={class:"container container-xs relative mx-auto xl:rounded xl:border xl:shadow-xl xl:my-5 p-5 pb-12 xl:pb-5 text-left dark:bg-gray-800 dark:text-gray-200 dark:border-gray-500",id:"global"},i={class:"mb-2"},l={class:"flex flex-wrap"},u=(0,o._)("div",{class:"w-3/4 text-left my-auto"},[(0,o._)("div",{class:"text-3xl xl:text-5xl lg:text-4xl font-light"},"Health Status")],-1),g={class:"w-1/4 flex justify-end"},d=["src"],c={key:1,src:r,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}};function h(e,t,n,s,r,h){var p=(0,o.up)("router-view"),f=(0,o.up)("Tooltip"),m=(0,o.up)("Social");return(0,o.wg)(),(0,o.iD)(o.HY,null,[(0,o._)("div",a,[(0,o._)("div",i,[(0,o._)("div",l,[u,(0,o._)("div",g,[h.getLogo?((0,o.wg)(),(0,o.iD)("img",{key:0,src:h.getLogo,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}},null,8,d)):((0,o.wg)(),(0,o.iD)("img",c))])])]),(0,o.Wm)(p,{onShowTooltip:h.showTooltip},null,8,["onShowTooltip"])]),(0,o.Wm)(f,{result:r.tooltip.result,event:r.tooltip.event},null,8,["result","event"]),(0,o.Wm)(m)],64)}var p=n.p+"img/github.png",f=function(e){return(0,o.dD)("data-v-a88161aa"),e=e(),(0,o.Cn)(),e},m={id:"social"},A=f((function(){return(0,o._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,o._)("img",{src:p,alt:"GitHub",width:"32",height:"auto"})],-1)})),v=[A];function w(e,t,n,s,r,a){return(0,o.wg)(),(0,o.iD)("div",m,v)}var y={name:"Social"},x=n(3744);const T=(0,x.Z)(y,[["render",w],["__scopeId","data-v-a88161aa"]]);var k=T,I=(n(6977),n(3577)),b=(0,o._)("div",{class:"tooltip-title"},"Timestamp:",-1),R={id:"tooltip-timestamp"},D=(0,o._)("div",{class:"tooltip-title"},"Response time:",-1),S={id:"tooltip-response-time"},C=(0,o._)("div",{class:"tooltip-title"},"Conditions:",-1),B={id:"tooltip-conditions"},E=(0,o._)("br",null,null,-1),P={key:0,id:"tooltip-errors-container"},H=(0,o._)("div",{class:"tooltip-title"},"Errors:",-1),O={id:"tooltip-errors"},U=(0,o._)("br",null,null,-1);function z(e,t,n,s,r,a){return(0,o.wg)(),(0,o.iD)("div",{id:"tooltip",ref:"tooltip",class:(0,I.C_)(r.hidden?"invisible":""),style:(0,I.j5)("top:"+r.top+"px; left:"+r.left+"px")},[n.result?(0,o.WI)(e.$slots,"default",{key:0},(function(){return[b,(0,o._)("code",R,(0,I.zw)(a.prettifyTimestamp(n.result.timestamp)),1),D,(0,o._)("code",S,(0,I.zw)((n.result.duration/1e6).toFixed(0))+"ms",1),C,(0,o._)("code",B,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(n.result.conditionResults,(function(t){return(0,o.WI)(e.$slots,"default",{key:t},(function(){return[(0,o.Uk)((0,I.zw)(t.success?"✓":"X")+" ~ "+(0,I.zw)(t.condition),1),E]}))})),128))]),n.result.errors&&n.result.errors.length?((0,o.wg)(),(0,o.iD)("div",P,[H,(0,o._)("code",O,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(n.result.errors,(function(t){return(0,o.WI)(e.$slots,"default",{key:t},(function(){return[(0,o.Uk)(" - "+(0,I.zw)(t),1),U]}))})),128))])])):(0,o.kq)("",!0)]})):(0,o.kq)("",!0)],6)}n(4916),n(5306);var M={name:"Endpoints",props:{event:Event,result:Object},methods:{prettifyTimestamp:function(e){var t=new Date(e),n=t.getFullYear(),s=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),o=(t.getDate()<10?"0":"")+t.getDate(),r=(t.getHours()<10?"0":"")+t.getHours(),a=(t.getMinutes()<10?"0":"")+t.getMinutes(),i=(t.getSeconds()<10?"0":"")+t.getSeconds();return n+"-"+s+"-"+o+" "+r+":"+a+":"+i},htmlEntities:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},reposition:function(){if(this.event&&this.event.type)if("mouseenter"===this.event.type){var e=this.event.target.getBoundingClientRect().y+30,t=this.event.target.getBoundingClientRect().x,n=this.$refs.tooltip.getBoundingClientRect();t+window.scrollX+n.width+50>document.body.getBoundingClientRect().width&&(t=this.event.target.getBoundingClientRect().x-n.width+this.event.target.getBoundingClientRect().width,t<0&&(t+=-t)),e+window.scrollY+n.height+50>document.body.getBoundingClientRect().height&&e>=0&&(e=this.event.target.getBoundingClientRect().y-(n.height+10),e<0&&(e=this.event.target.getBoundingClientRect().y+30)),this.top=e,this.left=t}else"mouseleave"===this.event.type&&(this.hidden=!0)}},watch:{event:function(e){e&&e.type&&("mouseenter"===e.type?this.hidden=!1:"mouseleave"===e.type&&(this.hidden=!0))}},updated:function(){this.reposition()},created:function(){this.reposition()},data:function(){return{hidden:!0,top:0,left:0}}};const Q=(0,x.Z)(M,[["render",z]]);var W=Q,X={name:"App",components:{Social:k,Tooltip:W},methods:{showTooltip:function(e,t){this.tooltip={result:e,event:t}}},computed:{getLogo:function(){return window.config&&window.config.logo&&"{{ .Logo }}"!==window.config.logo?window.config.logo:""}},data:function(){return{tooltip:{}}}};const K=(0,x.ZLine truncated
+1 -1
View File
@@ -1 +1 @@
(function(){"use strict";var e={2119:function(e,t,s){s.d(t,{L:function(){return Ft}});s(7727);var n=s(9963),o=s(6252),a=s.p+"img/logo.png";const r={class:"container container-xs relative mx-auto xl:rounded xl:border xl:shadow-xl xl:my-5 p-5 pb-12 xl:pb-5 text-left dark:bg-gray-800 dark:text-gray-200 dark:border-gray-500",id:"global"},i={class:"mb-2"},l={class:"flex flex-wrap"},g=(0,o._)("div",{class:"w-3/4 text-left my-auto"},[(0,o._)("div",{class:"text-3xl xl:text-5xl lg:text-4xl font-light"},"Health Status")],-1),d={class:"w-1/4 flex justify-end"},h=["src"],u={key:1,src:a,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}};function p(e,t,s,n,a,p){const c=(0,o.up)("router-view"),m=(0,o.up)("Tooltip"),A=(0,o.up)("Social");return(0,o.wg)(),(0,o.iD)(o.HY,null,[(0,o._)("div",r,[(0,o._)("div",i,[(0,o._)("div",l,[g,(0,o._)("div",d,[p.getLogo?((0,o.wg)(),(0,o.iD)("img",{key:0,src:p.getLogo,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}},null,8,h)):(0,o.kq)("",!0),p.getLogo?(0,o.kq)("",!0):((0,o.wg)(),(0,o.iD)("img",u))])])]),(0,o.Wm)(c,{onShowTooltip:p.showTooltip},null,8,["onShowTooltip"])]),(0,o.Wm)(m,{result:a.tooltip.result,event:a.tooltip.event},null,8,["result","event"]),(0,o.Wm)(A)],64)}var c=s.p+"img/github.png";const m=e=>((0,o.dD)("data-v-a88161aa"),e=e(),(0,o.Cn)(),e),A={id:"social"},f=m((()=>(0,o._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,o._)("img",{src:c,alt:"GitHub",width:"32",height:"auto"})],-1))),v=[f];function w(e,t,s,n,a,r){return(0,o.wg)(),(0,o.iD)("div",A,v)}var y={name:"Social"},x=s(3744);const T=(0,x.Z)(y,[["render",w],["__scopeId","data-v-a88161aa"]]);var k=T,I=s(3577);const b=(0,o._)("div",{class:"tooltip-title"},"Timestamp:",-1),R={id:"tooltip-timestamp"},D=(0,o._)("div",{class:"tooltip-title"},"Response time:",-1),S={id:"tooltip-response-time"},C=(0,o._)("div",{class:"tooltip-title"},"Conditions:",-1),B={id:"tooltip-conditions"},E=(0,o._)("br",null,null,-1),P={key:0,id:"tooltip-errors-container"},H=(0,o._)("div",{class:"tooltip-title"},"Errors:",-1),O={id:"tooltip-errors"},U=(0,o._)("br",null,null,-1);function z(e,t,s,n,a,r){return(0,o.wg)(),(0,o.iD)("div",{id:"tooltip",ref:"tooltip",class:(0,I.C_)(a.hidden?"invisible":""),style:(0,I.j5)("top:"+a.top+"px; left:"+a.left+"px")},[s.result?(0,o.WI)(e.$slots,"default",{key:0},(()=>[b,(0,o._)("code",R,(0,I.zw)(r.prettifyTimestamp(s.result.timestamp)),1),D,(0,o._)("code",S,(0,I.zw)((s.result.duration/1e6).toFixed(0))+"ms",1),C,(0,o._)("code",B,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(s.result.conditionResults,(t=>(0,o.WI)(e.$slots,"default",{key:t},(()=>[(0,o.Uk)((0,I.zw)(t.success?"✓":"X")+" ~ "+(0,I.zw)(t.condition),1),E])))),128))]),s.result.errors&&s.result.errors.length?((0,o.wg)(),(0,o.iD)("div",P,[H,(0,o._)("code",O,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(s.result.errors,(t=>(0,o.WI)(e.$slots,"default",{key:t},(()=>[(0,o.Uk)(" - "+(0,I.zw)(t),1),U])))),128))])])):(0,o.kq)("",!0)])):(0,o.kq)("",!0)],6)}s(5306);var M={name:"Endpoints",props:{event:Event,result:Object},methods:{prettifyTimestamp(e){let t=new Date(e),s=t.getFullYear(),n=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),o=(t.getDate()<10?"0":"")+t.getDate(),a=(t.getHours()<10?"0":"")+t.getHours(),r=(t.getMinutes()<10?"0":"")+t.getMinutes(),i=(t.getSeconds()<10?"0":"")+t.getSeconds();return s+"-"+n+"-"+o+" "+a+":"+r+":"+i},htmlEntities(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},reposition(){if(this.event&&this.event.type)if("mouseenter"===this.event.type){let e=this.event.target.getBoundingClientRect().y+30,t=this.event.target.getBoundingClientRect().x,s=this.$refs.tooltip.getBoundingClientRect();t+window.scrollX+s.width+50>document.body.getBoundingClientRect().width&&(t=this.event.target.getBoundingClientRect().x-s.width+this.event.target.getBoundingClientRect().width,t<0&&(t+=-t)),e+window.scrollY+s.height+50>document.body.getBoundingClientRect().height&&e>=0&&(e=this.event.target.getBoundingClientRect().y-(s.height+10),e<0&&(e=this.event.target.getBoundingClientRect().y+30)),this.top=e,this.left=t}else"mouseleave"===this.event.type&&(this.hidden=!0)}},watch:{event:function(e){e&&e.type&&("mouseenter"===e.type?this.hidden=!1:"mouseleave"===e.type&&(this.hidden=!0))}},updated(){this.reposition()},created(){this.reposition()},data(){return{hidden:!0,top:0,left:0}}};const Q=(0,x.Z)(M,[["render",z]]);var W=Q,X={name:"App",components:{Social:k,Tooltip:W},methods:{showTooltip(e,t){this.tooltip={result:e,event:t}}},computed:{getLogo(){return window.config&&window.config.logo&&"{{ .Logo }}"!==window.config.logo?window.config.logo:""}},data(){return{tooltip:{}}}};const q=(0,x.Z)(X,[["render",p]]);var K=q,Y=s(8810);function F(e,t,s,n,a,r){const i=(0,o.up)("Endpoints"),l=(0,o.up)("Pagination"),g=(0,o.up)("Settings");return(0,o.wg)(),(0,o.iLine truncated (function(){"use strict";var e={5804:function(e,t,s){s.d(t,{L:function(){return qt}});s(7727);var n=s(9963),o=s(6252),a=s.p+"img/logo.png";const r={class:"container container-xs relative mx-auto xl:rounded xl:border xl:shadow-xl xl:my-5 p-5 pb-12 xl:pb-5 text-left dark:bg-gray-800 dark:text-gray-200 dark:border-gray-500",id:"global"},i={class:"mb-2"},l={class:"flex flex-wrap"},g=(0,o._)("div",{class:"w-3/4 text-left my-auto"},[(0,o._)("div",{class:"text-3xl xl:text-5xl lg:text-4xl font-light"},"Health Status")],-1),d={class:"w-1/4 flex justify-end"},h=["src"],u={key:1,src:a,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}};function p(e,t,s,n,a,p){const c=(0,o.up)("router-view"),m=(0,o.up)("Tooltip"),A=(0,o.up)("Social");return(0,o.wg)(),(0,o.iD)(o.HY,null,[(0,o._)("div",r,[(0,o._)("div",i,[(0,o._)("div",l,[g,(0,o._)("div",d,[p.getLogo?((0,o.wg)(),(0,o.iD)("img",{key:0,src:p.getLogo,alt:"Gatus",class:"object-scale-down",style:{"max-width":"100px","min-width":"50px","min-height":"50px"}},null,8,h)):((0,o.wg)(),(0,o.iD)("img",u))])])]),(0,o.Wm)(c,{onShowTooltip:p.showTooltip},null,8,["onShowTooltip"])]),(0,o.Wm)(m,{result:a.tooltip.result,event:a.tooltip.event},null,8,["result","event"]),(0,o.Wm)(A)],64)}var c=s.p+"img/github.png";const m=e=>((0,o.dD)("data-v-a88161aa"),e=e(),(0,o.Cn)(),e),A={id:"social"},f=m((()=>(0,o._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,o._)("img",{src:c,alt:"GitHub",width:"32",height:"auto"})],-1))),v=[f];function w(e,t,s,n,a,r){return(0,o.wg)(),(0,o.iD)("div",A,v)}var y={name:"Social"},x=s(3744);const T=(0,x.Z)(y,[["render",w],["__scopeId","data-v-a88161aa"]]);var k=T,I=s(3577);const b=(0,o._)("div",{class:"tooltip-title"},"Timestamp:",-1),R={id:"tooltip-timestamp"},D=(0,o._)("div",{class:"tooltip-title"},"Response time:",-1),S={id:"tooltip-response-time"},C=(0,o._)("div",{class:"tooltip-title"},"Conditions:",-1),B={id:"tooltip-conditions"},E=(0,o._)("br",null,null,-1),P={key:0,id:"tooltip-errors-container"},H=(0,o._)("div",{class:"tooltip-title"},"Errors:",-1),O={id:"tooltip-errors"},U=(0,o._)("br",null,null,-1);function z(e,t,s,n,a,r){return(0,o.wg)(),(0,o.iD)("div",{id:"tooltip",ref:"tooltip",class:(0,I.C_)(a.hidden?"invisible":""),style:(0,I.j5)("top:"+a.top+"px; left:"+a.left+"px")},[s.result?(0,o.WI)(e.$slots,"default",{key:0},(()=>[b,(0,o._)("code",R,(0,I.zw)(r.prettifyTimestamp(s.result.timestamp)),1),D,(0,o._)("code",S,(0,I.zw)((s.result.duration/1e6).toFixed(0))+"ms",1),C,(0,o._)("code",B,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(s.result.conditionResults,(t=>(0,o.WI)(e.$slots,"default",{key:t},(()=>[(0,o.Uk)((0,I.zw)(t.success?"✓":"X")+" ~ "+(0,I.zw)(t.condition),1),E])))),128))]),s.result.errors&&s.result.errors.length?((0,o.wg)(),(0,o.iD)("div",P,[H,(0,o._)("code",O,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(s.result.errors,(t=>(0,o.WI)(e.$slots,"default",{key:t},(()=>[(0,o.Uk)(" - "+(0,I.zw)(t),1),U])))),128))])])):(0,o.kq)("",!0)])):(0,o.kq)("",!0)],6)}s(5306);var M={name:"Endpoints",props:{event:Event,result:Object},methods:{prettifyTimestamp(e){let t=new Date(e),s=t.getFullYear(),n=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),o=(t.getDate()<10?"0":"")+t.getDate(),a=(t.getHours()<10?"0":"")+t.getHours(),r=(t.getMinutes()<10?"0":"")+t.getMinutes(),i=(t.getSeconds()<10?"0":"")+t.getSeconds();return s+"-"+n+"-"+o+" "+a+":"+r+":"+i},htmlEntities(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},reposition(){if(this.event&&this.event.type)if("mouseenter"===this.event.type){let e=this.event.target.getBoundingClientRect().y+30,t=this.event.target.getBoundingClientRect().x,s=this.$refs.tooltip.getBoundingClientRect();t+window.scrollX+s.width+50>document.body.getBoundingClientRect().width&&(t=this.event.target.getBoundingClientRect().x-s.width+this.event.target.getBoundingClientRect().width,t<0&&(t+=-t)),e+window.scrollY+s.height+50>document.body.getBoundingClientRect().height&&e>=0&&(e=this.event.target.getBoundingClientRect().y-(s.height+10),e<0&&(e=this.event.target.getBoundingClientRect().y+30)),this.top=e,this.left=t}else"mouseleave"===this.event.type&&(this.hidden=!0)}},watch:{event:function(e){e&&e.type&&("mouseenter"===e.type?this.hidden=!1:"mouseleave"===e.type&&(this.hidden=!0))}},updated(){this.reposition()},created(){this.reposition()},data(){return{hidden:!0,top:0,left:0}}};const Q=(0,x.Z)(M,[["render",z]]);var W=Q,X={name:"App",components:{Social:k,Tooltip:W},methods:{showTooltip(e,t){this.tooltip={result:e,event:t}}},computed:{getLogo(){return window.config&&window.config.logo&&"{{ .Logo }}"!==window.config.logo?window.config.logo:""}},data(){return{tooltip:{}}}};const K=(0,x.Z)(X,[["render",p]]);var Y=K,F=s(2119);function q(e,t,s,n,a,r){const i=(0,o.up)("Endpoints"),l=(0,o.up)("Pagination"),g=(0,o.up)("Settings");return(0,o.wg)(),(0,o.iD)(o.HY,null,[(0,o.Wm)(i,{endpointStatusesLine truncated
+3 -3
View File
@@ -1,7 +1,7 @@
(self["webpackChunkgatus"]=self["webpackChunkgatus"]||[]).push([[998],{2262:function(e,t,n){"use strict";n.d(t,{Bj:function(){return c},qq:function(){return w},Fl:function(){return Ve},X3:function(){return Re},PG:function(){return Ce},dq:function(){return Me},Xl:function(){return je},Jd:function(){return S},WL:function(){return Ge},qj:function(){return ke},iH:function(){return $e},lk:function(){return C},Um:function(){return Ee},XI:function(){return Ue},IU:function(){return Ie},j:function(){return A},X$:function(){return j},SU:function(){return Je}});var r=n(3577);let o;const i=[];class c{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&o&&(this.parent=o,this.index=(o.scopes||(o.scopes=[])).push(this)-1)}run(e){if(this.active)try{return this.on(),e()}finally{this.off()}else 0}on(){this.active&&(i.push(this),o=this)}off(){this.active&&(i.pop(),o=i[i.length-1])}stop(e){if(this.active){if(this.effects.forEach((e=>e.stop())),this.cleanups.forEach((e=>e())),this.scopes&&this.scopes.forEach((e=>e.stop(!0))),this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.active=!1}}}function s(e,t){t=t||o,t&&t.active&&t.effects.push(e)}const u=e=>{const t=new Set(e);return t.w=0,t.n=0,t},l=e=>(e.w&v)>0,a=e=>(e.n&v)>0,f=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=v},p=e=>{const{deps:t}=e;if(t.length){let n=0;for(let r=0;r<t.length;r++){const o=t[r];l(o)&&!a(o)?o.delete(e):t[n++]=o,o.w&=~v,o.n&=~v}t.length=n}},d=new WeakMap;let h=0,v=1;const g=30,m=[];let y;const b=Symbol(""),x=Symbol("");class w{constructor(e,t=null,n){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],s(this,n)}run(){if(!this.active)return this.fn();if(!m.includes(this))try{return m.push(y=this),O(),v=1<<++h,h<=g?f(this):_(this),this.fn()}finally{h<=g&&p(this),v=1<<--h,C(),m.pop();const e=m.length;y=e>0?m[e-1]:void 0}}stop(){this.active&&(_(this),this.onStop&&this.onStop(),this.active=!1)}}function _(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let k=!0;const E=[];function S(){E.push(k),k=!1}function O(){E.push(k),k=!0}function C(){const e=E.pop();k=void 0===e||e}function A(e,t,n){if(!R())return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=u());const i=void 0;I(o,i)}function R(){return k&&void 0!==y}function I(e,t){let n=!1;h<=g?a(e)||(e.n|=v,n=!l(e)):n=!e.has(y),n&&(e.add(y),y.deps.push(e))}function j(e,t,n,o,i,c){const s=d.get(e);if(!s)return;let l=[];if("clear"===t)l=[...s.values()];else if("length"===n&&(0,r.kJ)(e))s.forEach(((e,t)=>{("length"===t||t>=o)&&l.push(e)}));else switch(void 0!==n&&l.push(s.get(n)),t){case"add":(0,r.kJ)(e)?(0,r.S0)(n)&&l.push(s.get("length")):(l.push(s.get(b)),(0,r._N)(e)&&l.push(s.get(x)));break;case"delete":(0,r.kJ)(e)||(l.push(s.get(b)),(0,r._N)(e)&&l.push(s.get(x)));break;case"set":(0,r._N)(e)&&l.push(s.get(b));break}if(1===l.length)l[0]&&T(l[0]);else{const e=[];for(const t of l)t&&e.push(...t);T(u(e))}}function T(e,t){for(const n of(0,r.kJ)(e)?e:[...e])(n!==y||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const P=(0,r.fY)("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(r.yk)),N=D(),M=D(!1,!0),$=D(!0),U=L();function L(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=Ie(this);for(let t=0,o=this.length;t<o;t++)A(n,"get",t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Ie)):r}})),["push","pop","shift","unshift","splice"].forEach((t=>{e[t]=function(...e){S();const n=Ie(this)[t].apply(this,e);return C(),n}})),e}function D(e=!1,t=!1){return function(n,o,i){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&i===(e?t?xe:be:t?ye:me).get(n))return n;const c=(0,r.kJ)(n);if(!e&&c&&(0,r.RI)(U,o))return Reflect.get(U,o,i);const s=Reflect.get(n,o,i);if((0,r.yk)(o)?F.has(o):P(o))return s;if(e||A(n,"get",o),t)return s;if(Me(s)){const e=!c||!(0,r.S0)(o);return e?s.value:s}return(0,r.Kn)(s)?e?Se(s):ke(s):s}}const J=G(),B=G(!0);function G(e=!1){return function(t,n,o,i){let c=t[n];if(!e&&(o=Ie(o),c=Ie(c),!(0,r.kJ)(t)&&Me(c)&&!Me(o)))return c.value=o,!0;const s=(0,r.kJ)(t)&&(0,r.S0)(n)?Number(n)<t.length:(0,r.RI)(t,n),u=Reflect.set(t,n,o,i);return t===Ie(i)&&(s?(0,r.aU)(o,c)&&j(t,"set",n,o,c):j(t,"add",n,o)),u}}function q(e,t){const n=(0,r.RI)(e,t),o=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&j(e,"delete",t,void 0,o),i}function V(e,t){const n=Reflect.has(e,t);return(0,r.yk)(t)&&F.has(t)||A(e,"has",t),n}function W(e){return A(e,"iterate",(0,r.kJ)(e)?"length":b),Reflect.ownKeys(e)}const H={get:N,set:J,deleteProperty:q,has:V,ownKeys:W},K={get:$,set(e,t){return!0},deleteProperty(e,t){return!0}},z=(0,r.l7)({},H,{get:M,set:B}),X=e=>e,Y=e=>Reflect.getPrototypeOf(e);function Z(e,t,n=!1,r=!1){e=e["__v_raw"];const o=Ie(e),i=Ie(t);t!==i&&!n&&A(o,"get",t),!n&&A(o,"get",i);const{has:c}=Y(o),s=r?X:n?Pe:Te;return c.call(o,t)?s(e.get(t)Line truncated (self["webpackChunkgatus"]=self["webpackChunkgatus"]||[]).push([[998],{2262:function(e,t,n){"use strict";n.d(t,{Bj:function(){return c},qq:function(){return w},Fl:function(){return Ve},X3:function(){return Ae},PG:function(){return Ce},dq:function(){return Me},Xl:function(){return je},Jd:function(){return S},WL:function(){return Ge},qj:function(){return ke},iH:function(){return $e},lk:function(){return C},Um:function(){return Ee},XI:function(){return Ue},IU:function(){return Ie},j:function(){return R},X$:function(){return j},SU:function(){return Je}});var r=n(3577);let o;const i=[];class c{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&o&&(this.parent=o,this.index=(o.scopes||(o.scopes=[])).push(this)-1)}run(e){if(this.active)try{return this.on(),e()}finally{this.off()}else 0}on(){this.active&&(i.push(this),o=this)}off(){this.active&&(i.pop(),o=i[i.length-1])}stop(e){if(this.active){if(this.effects.forEach((e=>e.stop())),this.cleanups.forEach((e=>e())),this.scopes&&this.scopes.forEach((e=>e.stop(!0))),this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.active=!1}}}function s(e,t){t=t||o,t&&t.active&&t.effects.push(e)}const u=e=>{const t=new Set(e);return t.w=0,t.n=0,t},a=e=>(e.w&v)>0,l=e=>(e.n&v)>0,f=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=v},p=e=>{const{deps:t}=e;if(t.length){let n=0;for(let r=0;r<t.length;r++){const o=t[r];a(o)&&!l(o)?o.delete(e):t[n++]=o,o.w&=~v,o.n&=~v}t.length=n}},d=new WeakMap;let h=0,v=1;const g=30,m=[];let y;const b=Symbol(""),x=Symbol("");class w{constructor(e,t=null,n){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],s(this,n)}run(){if(!this.active)return this.fn();if(!m.includes(this))try{return m.push(y=this),O(),v=1<<++h,h<=g?f(this):_(this),this.fn()}finally{h<=g&&p(this),v=1<<--h,C(),m.pop();const e=m.length;y=e>0?m[e-1]:void 0}}stop(){this.active&&(_(this),this.onStop&&this.onStop(),this.active=!1)}}function _(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let k=!0;const E=[];function S(){E.push(k),k=!1}function O(){E.push(k),k=!0}function C(){const e=E.pop();k=void 0===e||e}function R(e,t,n){if(!A())return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=u());const i=void 0;I(o,i)}function A(){return k&&void 0!==y}function I(e,t){let n=!1;h<=g?l(e)||(e.n|=v,n=!a(e)):n=!e.has(y),n&&(e.add(y),y.deps.push(e))}function j(e,t,n,o,i,c){const s=d.get(e);if(!s)return;let a=[];if("clear"===t)a=[...s.values()];else if("length"===n&&(0,r.kJ)(e))s.forEach(((e,t)=>{("length"===t||t>=o)&&a.push(e)}));else switch(void 0!==n&&a.push(s.get(n)),t){case"add":(0,r.kJ)(e)?(0,r.S0)(n)&&a.push(s.get("length")):(a.push(s.get(b)),(0,r._N)(e)&&a.push(s.get(x)));break;case"delete":(0,r.kJ)(e)||(a.push(s.get(b)),(0,r._N)(e)&&a.push(s.get(x)));break;case"set":(0,r._N)(e)&&a.push(s.get(b));break}if(1===a.length)a[0]&&T(a[0]);else{const e=[];for(const t of a)t&&e.push(...t);T(u(e))}}function T(e,t){for(const n of(0,r.kJ)(e)?e:[...e])(n!==y||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const P=(0,r.fY)("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(r.yk)),N=D(),M=D(!1,!0),$=D(!0),U=L();function L(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=Ie(this);for(let t=0,o=this.length;t<o;t++)R(n,"get",t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Ie)):r}})),["push","pop","shift","unshift","splice"].forEach((t=>{e[t]=function(...e){S();const n=Ie(this)[t].apply(this,e);return C(),n}})),e}function D(e=!1,t=!1){return function(n,o,i){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&i===(e?t?xe:be:t?ye:me).get(n))return n;const c=(0,r.kJ)(n);if(!e&&c&&(0,r.RI)(U,o))return Reflect.get(U,o,i);const s=Reflect.get(n,o,i);if((0,r.yk)(o)?F.has(o):P(o))return s;if(e||R(n,"get",o),t)return s;if(Me(s)){const e=!c||!(0,r.S0)(o);return e?s.value:s}return(0,r.Kn)(s)?e?Se(s):ke(s):s}}const J=G(),B=G(!0);function G(e=!1){return function(t,n,o,i){let c=t[n];if(!e&&(o=Ie(o),c=Ie(c),!(0,r.kJ)(t)&&Me(c)&&!Me(o)))return c.value=o,!0;const s=(0,r.kJ)(t)&&(0,r.S0)(n)?Number(n)<t.length:(0,r.RI)(t,n),u=Reflect.set(t,n,o,i);return t===Ie(i)&&(s?(0,r.aU)(o,c)&&j(t,"set",n,o,c):j(t,"add",n,o)),u}}function q(e,t){const n=(0,r.RI)(e,t),o=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&j(e,"delete",t,void 0,o),i}function V(e,t){const n=Reflect.has(e,t);return(0,r.yk)(t)&&F.has(t)||R(e,"has",t),n}function W(e){return R(e,"iterate",(0,r.kJ)(e)?"length":b),Reflect.ownKeys(e)}const H={get:N,set:J,deleteProperty:q,has:V,ownKeys:W},K={get:$,set(e,t){return!0},deleteProperty(e,t){return!0}},z=(0,r.l7)({},H,{get:M,set:B}),X=e=>e,Y=e=>Reflect.getPrototypeOf(e);function Z(e,t,n=!1,r=!1){e=e["__v_raw"];const o=Ie(e),i=Ie(t);t!==i&&!n&&R(o,"get",t),!n&&R(o,"get",i);const{has:c}=Y(o),s=r?X:n?Pe:Te;return c.call(o,t)?s(e.get(t)Line truncated
/*! /*!
* vue-router v4.0.11 * vue-router v4.0.12
* (c) 2021 Eduardo San Martin Morote * (c) 2021 Eduardo San Martin Morote
* @license MIT * @license MIT
*/ */
const i="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag,c=e=>i?Symbol(e):"_vr_"+e,s=c("rvlm"),u=c("rvd"),l=c("r"),a=c("rl"),f=c("rvl"),p="undefined"!==typeof window;function d(e){return e.__esModule||i&&"Module"===e[Symbol.toStringTag]}const h=Object.assign;function v(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const g=()=>{};const m=/\/$/,y=e=>e.replace(m,"");function b(e,t,n="/"){let r,o={},i="",c="";const s=t.indexOf("?"),u=t.indexOf("#",s>-1?s:0);return s>-1&&(r=t.slice(0,s),i=t.slice(s+1,u>-1?u:t.length),o=e(i)),u>-1&&(r=r||t.slice(0,u),c=t.slice(u,t.length)),r=C(null!=r?r:t,n),{fullPath:r+(i&&"?")+i+c,path:r,query:o,hash:c}}function x(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function w(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function _(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&k(t.matched[r],n.matched[o])&&E(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function k(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function E(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!S(e[n],t[n]))return!1;return!0}function S(e,t){return Array.isArray(e)?O(e,t):Array.isArray(t)?O(t,e):e===t}function O(e,t){return Array.isArray(t)?e.length===t.length&&e.every(((e,n)=>e===t[n])):1===e.length&&e[0]===t}function C(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o,i,c=n.length-1;for(o=0;o<r.length;o++)if(i=r[o],1!==c&&"."!==i){if(".."!==i)break;c--}return n.slice(0,c).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}var A,R;(function(e){e["pop"]="pop",e["push"]="push"})(A||(A={})),function(e){e["back"]="back",e["forward"]="forward",e["unknown"]=""}(R||(R={}));function I(e){if(!e)if(p){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return"/"!==e[0]&&"#"!==e[0]&&(e="/"+e),y(e)}const j=/^[^#]+#/;function T(e,t){return e.replace(j,"#")+t}function P(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const F=()=>({left:window.pageXOffset,top:window.pageYOffset});function N(e){let t;if("el"in e){const n=e.el,r="string"===typeof n&&n.startsWith("#");0;const o="string"===typeof n?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=P(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}function M(e,t){const n=history.state?history.state.position-t:-1;return n+e}const $=new Map;function U(e,t){$.set(e,t)}function L(e){const t=$.get(e);return $.delete(e),t}let D=()=>location.protocol+"//"+location.host;function J(e,t){const{pathname:n,search:r,hash:o}=t,i=e.indexOf("#");if(i>-1){let t=o.includes(e.slice(i))?e.slice(i).length:1,n=o.slice(t);return"/"!==n[0]&&(n="/"+n),w(n,"")}const c=w(n,e);return c+r+o}function B(e,t,n,r){let o=[],i=[],c=null;const s=({state:i})=>{const s=J(e,location),u=n.value,l=t.value;let a=0;if(i){if(n.value=s,t.value=i,c&&c===u)return void(c=null);a=l?i.position-l.position:0}else r(s);o.forEach((e=>{e(n.value,u,{delta:a,type:A.pop,direction:a?a>0?R.forward:R.back:R.unknown})}))};function u(){c=n.value}function l(e){o.push(e);const t=()=>{const t=o.indexOf(e);t>-1&&o.splice(t,1)};return i.push(t),t}function a(){const{history:e}=window;e.state&&e.replaceState(h({},e.state,{scroll:F()}),"")}function f(){for(const e of i)e();i=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",a)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",a),{pauseListeners:u,listen:l,destroy:f}}function G(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?F():null}}function q(e){const{history:t,location:n}=window,r={value:J(e,n)},o={value:t.state};function i(r,i,c){const s=e.indexOf("#"),u=s>-1?(n.host&&document.querySelector("base")?e:e.slice(s))+r:D()+e+r;try{t[c?"replaceState":"pushState"](i,"",u),o.value=i}catch(l){console.error(l),n[c?"replace":"assign"](u)}}function c(e,n){const c=h({},t.state,G(o.value.back,e,o.value.forward,!0),n,{position:o.value.position});i(e,c,!0),r.value=e}function s(e,n){const c=h({},o.value,t.state,{forward:e,scroll:F()});i(c.current,c,!0);const s=h({},G(r.value,e,null),{position:c.position+1},n);i(e,s,!1),r.value=e}return o.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0),{location:r,state:o,push:s,replace:c}}function V(e){e=I(e);const t=q(e),n=B(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}const o=h({location:"",base:e,go:r,createHref:T.bind(null,e)},t,n);return Object.defineProperty(o,"loLine truncated const i="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag,c=e=>i?Symbol(e):"_vr_"+e,s=c("rvlm"),u=c("rvd"),a=c("r"),l=c("rl"),f=c("rvl"),p="undefined"!==typeof window;function d(e){return e.__esModule||i&&"Module"===e[Symbol.toStringTag]}const h=Object.assign;function v(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const g=()=>{};const m=/\/$/,y=e=>e.replace(m,"");function b(e,t,n="/"){let r,o={},i="",c="";const s=t.indexOf("?"),u=t.indexOf("#",s>-1?s:0);return s>-1&&(r=t.slice(0,s),i=t.slice(s+1,u>-1?u:t.length),o=e(i)),u>-1&&(r=r||t.slice(0,u),c=t.slice(u,t.length)),r=C(null!=r?r:t,n),{fullPath:r+(i&&"?")+i+c,path:r,query:o,hash:c}}function x(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function w(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function _(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&k(t.matched[r],n.matched[o])&&E(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function k(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function E(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!S(e[n],t[n]))return!1;return!0}function S(e,t){return Array.isArray(e)?O(e,t):Array.isArray(t)?O(t,e):e===t}function O(e,t){return Array.isArray(t)?e.length===t.length&&e.every(((e,n)=>e===t[n])):1===e.length&&e[0]===t}function C(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o,i,c=n.length-1;for(o=0;o<r.length;o++)if(i=r[o],1!==c&&"."!==i){if(".."!==i)break;c--}return n.slice(0,c).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}var R,A;(function(e){e["pop"]="pop",e["push"]="push"})(R||(R={})),function(e){e["back"]="back",e["forward"]="forward",e["unknown"]=""}(A||(A={}));function I(e){if(!e)if(p){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return"/"!==e[0]&&"#"!==e[0]&&(e="/"+e),y(e)}const j=/^[^#]+#/;function T(e,t){return e.replace(j,"#")+t}function P(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const F=()=>({left:window.pageXOffset,top:window.pageYOffset});function N(e){let t;if("el"in e){const n=e.el,r="string"===typeof n&&n.startsWith("#");0;const o="string"===typeof n?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=P(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}function M(e,t){const n=history.state?history.state.position-t:-1;return n+e}const $=new Map;function U(e,t){$.set(e,t)}function L(e){const t=$.get(e);return $.delete(e),t}let D=()=>location.protocol+"//"+location.host;function J(e,t){const{pathname:n,search:r,hash:o}=t,i=e.indexOf("#");if(i>-1){let t=o.includes(e.slice(i))?e.slice(i).length:1,n=o.slice(t);return"/"!==n[0]&&(n="/"+n),w(n,"")}const c=w(n,e);return c+r+o}function B(e,t,n,r){let o=[],i=[],c=null;const s=({state:i})=>{const s=J(e,location),u=n.value,a=t.value;let l=0;if(i){if(n.value=s,t.value=i,c&&c===u)return void(c=null);l=a?i.position-a.position:0}else r(s);o.forEach((e=>{e(n.value,u,{delta:l,type:R.pop,direction:l?l>0?A.forward:A.back:A.unknown})}))};function u(){c=n.value}function a(e){o.push(e);const t=()=>{const t=o.indexOf(e);t>-1&&o.splice(t,1)};return i.push(t),t}function l(){const{history:e}=window;e.state&&e.replaceState(h({},e.state,{scroll:F()}),"")}function f(){for(const e of i)e();i=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",l)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",l),{pauseListeners:u,listen:a,destroy:f}}function G(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?F():null}}function q(e){const{history:t,location:n}=window,r={value:J(e,n)},o={value:t.state};function i(r,i,c){const s=e.indexOf("#"),u=s>-1?(n.host&&document.querySelector("base")?e:e.slice(s))+r:D()+e+r;try{t[c?"replaceState":"pushState"](i,"",u),o.value=i}catch(a){console.error(a),n[c?"replace":"assign"](u)}}function c(e,n){const c=h({},t.state,G(o.value.back,e,o.value.forward,!0),n,{position:o.value.position});i(e,c,!0),r.value=e}function s(e,n){const c=h({},o.value,t.state,{forward:e,scroll:F()});i(c.current,c,!0);const s=h({},G(r.value,e,null),{position:c.position+1},n);i(e,s,!1),r.value=e}return o.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0),{location:r,state:o,push:s,replace:c}}function V(e){e=I(e);const t=q(e),n=B(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}const o=h({location:"",base:e,go:r,createHref:T.bind(null,e)},t,n);return Object.defineProperty(o,"loLine truncated
+3 -3
View File
@@ -1,7 +1,7 @@
(self["webpackChunkgatus"]=self["webpackChunkgatus"]||[]).push([[998],{2262:function(e,t,n){"use strict";n.d(t,{Bj:function(){return s},qq:function(){return _},Fl:function(){return qe},X3:function(){return Ae},PG:function(){return Ee},dq:function(){return Me},Xl:function(){return Ie},Jd:function(){return C},WL:function(){return Ge},qj:function(){return ke},iH:function(){return $e},lk:function(){return E},Um:function(){return Se},XI:function(){return Ue},IU:function(){return Te},j:function(){return R},X$:function(){return I},SU:function(){return Je}});var r=n(3577);let o;const i=[];class s{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&o&&(this.parent=o,this.index=(o.scopes||(o.scopes=[])).push(this)-1)}run(e){if(this.active)try{return this.on(),e()}finally{this.off()}else 0}on(){this.active&&(i.push(this),o=this)}off(){this.active&&(i.pop(),o=i[i.length-1])}stop(e){if(this.active){if(this.effects.forEach((e=>e.stop())),this.cleanups.forEach((e=>e())),this.scopes&&this.scopes.forEach((e=>e.stop(!0))),this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.active=!1}}}function c(e,t){t=t||o,t&&t.active&&t.effects.push(e)}const l=e=>{const t=new Set(e);return t.w=0,t.n=0,t},u=e=>(e.w&v)>0,a=e=>(e.n&v)>0,f=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=v},p=e=>{const{deps:t}=e;if(t.length){let n=0;for(let r=0;r<t.length;r++){const o=t[r];u(o)&&!a(o)?o.delete(e):t[n++]=o,o.w&=~v,o.n&=~v}t.length=n}},d=new WeakMap;let h=0,v=1;const g=30,m=[];let y;const b=Symbol(""),x=Symbol("");class _{constructor(e,t=null,n){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],c(this,n)}run(){if(!this.active)return this.fn();if(!m.includes(this))try{return m.push(y=this),O(),v=1<<++h,h<=g?f(this):w(this),this.fn()}finally{h<=g&&p(this),v=1<<--h,E(),m.pop();const e=m.length;y=e>0?m[e-1]:void 0}}stop(){this.active&&(w(this),this.onStop&&this.onStop(),this.active=!1)}}function w(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let k=!0;const S=[];function C(){S.push(k),k=!1}function O(){S.push(k),k=!0}function E(){const e=S.pop();k=void 0===e||e}function R(e,t,n){if(!A())return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=l());const i=void 0;T(o,i)}function A(){return k&&void 0!==y}function T(e,t){let n=!1;h<=g?a(e)||(e.n|=v,n=!u(e)):n=!e.has(y),n&&(e.add(y),y.deps.push(e))}function I(e,t,n,o,i,s){const c=d.get(e);if(!c)return;let u=[];if("clear"===t)u=[...c.values()];else if("length"===n&&(0,r.kJ)(e))c.forEach(((e,t)=>{("length"===t||t>=o)&&u.push(e)}));else switch(void 0!==n&&u.push(c.get(n)),t){case"add":(0,r.kJ)(e)?(0,r.S0)(n)&&u.push(c.get("length")):(u.push(c.get(b)),(0,r._N)(e)&&u.push(c.get(x)));break;case"delete":(0,r.kJ)(e)||(u.push(c.get(b)),(0,r._N)(e)&&u.push(c.get(x)));break;case"set":(0,r._N)(e)&&u.push(c.get(b));break}if(1===u.length)u[0]&&P(u[0]);else{const e=[];for(const t of u)t&&e.push(...t);P(l(e))}}function P(e,t){for(const n of(0,r.kJ)(e)?e:[...e])(n!==y||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const j=(0,r.fY)("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(r.yk)),L=D(),M=D(!1,!0),$=D(!0),U=N();function N(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=Te(this);for(let t=0,o=this.length;t<o;t++)R(n,"get",t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Te)):r}})),["push","pop","shift","unshift","splice"].forEach((t=>{e[t]=function(...e){C();const n=Te(this)[t].apply(this,e);return E(),n}})),e}function D(e=!1,t=!1){return function(n,o,i){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&i===(e?t?xe:be:t?ye:me).get(n))return n;const s=(0,r.kJ)(n);if(!e&&s&&(0,r.RI)(U,o))return Reflect.get(U,o,i);const c=Reflect.get(n,o,i);if((0,r.yk)(o)?F.has(o):j(o))return c;if(e||R(n,"get",o),t)return c;if(Me(c)){const e=!s||!(0,r.S0)(o);return e?c.value:c}return(0,r.Kn)(c)?e?Ce(c):ke(c):c}}const J=G(),B=G(!0);function G(e=!1){return function(t,n,o,i){let s=t[n];if(!e&&(o=Te(o),s=Te(s),!(0,r.kJ)(t)&&Me(s)&&!Me(o)))return s.value=o,!0;const c=(0,r.kJ)(t)&&(0,r.S0)(n)?Number(n)<t.length:(0,r.RI)(t,n),l=Reflect.set(t,n,o,i);return t===Te(i)&&(c?(0,r.aU)(o,s)&&I(t,"set",n,o,s):I(t,"add",n,o)),l}}function V(e,t){const n=(0,r.RI)(e,t),o=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&I(e,"delete",t,void 0,o),i}function q(e,t){const n=Reflect.has(e,t);return(0,r.yk)(t)&&F.has(t)||R(e,"has",t),n}function H(e){return R(e,"iterate",(0,r.kJ)(e)?"length":b),Reflect.ownKeys(e)}const W={get:L,set:J,deleteProperty:V,has:q,ownKeys:H},K={get:$,set(e,t){return!0},deleteProperty(e,t){return!0}},z=(0,r.l7)({},W,{get:M,set:B}),X=e=>e,Y=e=>Reflect.getPrototypeOf(e);function Z(e,t,n=!1,r=!1){e=e["__v_raw"];const o=Te(e),i=Te(t);t!==i&&!n&&R(o,"get",t),!n&&R(o,"get",i);const{has:s}=Y(o),c=r?X:n?je:Pe;return s.call(o,t)?c(e.get(t)Line truncated (self["webpackChunkgatus"]=self["webpackChunkgatus"]||[]).push([[998],{2262:function(e,t,n){"use strict";n.d(t,{Bj:function(){return s},qq:function(){return _},Fl:function(){return qe},X3:function(){return Ae},PG:function(){return Ee},dq:function(){return Me},Xl:function(){return Ie},Jd:function(){return C},WL:function(){return Ge},qj:function(){return ke},iH:function(){return $e},lk:function(){return E},Um:function(){return Se},XI:function(){return Ue},IU:function(){return Te},j:function(){return R},X$:function(){return I},SU:function(){return Je}});var r=n(3577);let o;const i=[];class s{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&o&&(this.parent=o,this.index=(o.scopes||(o.scopes=[])).push(this)-1)}run(e){if(this.active)try{return this.on(),e()}finally{this.off()}else 0}on(){this.active&&(i.push(this),o=this)}off(){this.active&&(i.pop(),o=i[i.length-1])}stop(e){if(this.active){if(this.effects.forEach((e=>e.stop())),this.cleanups.forEach((e=>e())),this.scopes&&this.scopes.forEach((e=>e.stop(!0))),this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.active=!1}}}function c(e,t){t=t||o,t&&t.active&&t.effects.push(e)}const u=e=>{const t=new Set(e);return t.w=0,t.n=0,t},l=e=>(e.w&v)>0,a=e=>(e.n&v)>0,f=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=v},p=e=>{const{deps:t}=e;if(t.length){let n=0;for(let r=0;r<t.length;r++){const o=t[r];l(o)&&!a(o)?o.delete(e):t[n++]=o,o.w&=~v,o.n&=~v}t.length=n}},d=new WeakMap;let h=0,v=1;const g=30,m=[];let y;const b=Symbol(""),x=Symbol("");class _{constructor(e,t=null,n){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],c(this,n)}run(){if(!this.active)return this.fn();if(!m.includes(this))try{return m.push(y=this),O(),v=1<<++h,h<=g?f(this):w(this),this.fn()}finally{h<=g&&p(this),v=1<<--h,E(),m.pop();const e=m.length;y=e>0?m[e-1]:void 0}}stop(){this.active&&(w(this),this.onStop&&this.onStop(),this.active=!1)}}function w(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let k=!0;const S=[];function C(){S.push(k),k=!1}function O(){S.push(k),k=!0}function E(){const e=S.pop();k=void 0===e||e}function R(e,t,n){if(!A())return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=u());const i=void 0;T(o,i)}function A(){return k&&void 0!==y}function T(e,t){let n=!1;h<=g?a(e)||(e.n|=v,n=!l(e)):n=!e.has(y),n&&(e.add(y),y.deps.push(e))}function I(e,t,n,o,i,s){const c=d.get(e);if(!c)return;let l=[];if("clear"===t)l=[...c.values()];else if("length"===n&&(0,r.kJ)(e))c.forEach(((e,t)=>{("length"===t||t>=o)&&l.push(e)}));else switch(void 0!==n&&l.push(c.get(n)),t){case"add":(0,r.kJ)(e)?(0,r.S0)(n)&&l.push(c.get("length")):(l.push(c.get(b)),(0,r._N)(e)&&l.push(c.get(x)));break;case"delete":(0,r.kJ)(e)||(l.push(c.get(b)),(0,r._N)(e)&&l.push(c.get(x)));break;case"set":(0,r._N)(e)&&l.push(c.get(b));break}if(1===l.length)l[0]&&P(l[0]);else{const e=[];for(const t of l)t&&e.push(...t);P(u(e))}}function P(e,t){for(const n of(0,r.kJ)(e)?e:[...e])(n!==y||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const j=(0,r.fY)("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(r.yk)),L=D(),M=D(!1,!0),$=D(!0),U=N();function N(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=Te(this);for(let t=0,o=this.length;t<o;t++)R(n,"get",t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Te)):r}})),["push","pop","shift","unshift","splice"].forEach((t=>{e[t]=function(...e){C();const n=Te(this)[t].apply(this,e);return E(),n}})),e}function D(e=!1,t=!1){return function(n,o,i){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&i===(e?t?xe:be:t?ye:me).get(n))return n;const s=(0,r.kJ)(n);if(!e&&s&&(0,r.RI)(U,o))return Reflect.get(U,o,i);const c=Reflect.get(n,o,i);if((0,r.yk)(o)?F.has(o):j(o))return c;if(e||R(n,"get",o),t)return c;if(Me(c)){const e=!s||!(0,r.S0)(o);return e?c.value:c}return(0,r.Kn)(c)?e?Ce(c):ke(c):c}}const J=G(),B=G(!0);function G(e=!1){return function(t,n,o,i){let s=t[n];if(!e&&(o=Te(o),s=Te(s),!(0,r.kJ)(t)&&Me(s)&&!Me(o)))return s.value=o,!0;const c=(0,r.kJ)(t)&&(0,r.S0)(n)?Number(n)<t.length:(0,r.RI)(t,n),u=Reflect.set(t,n,o,i);return t===Te(i)&&(c?(0,r.aU)(o,s)&&I(t,"set",n,o,s):I(t,"add",n,o)),u}}function V(e,t){const n=(0,r.RI)(e,t),o=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&I(e,"delete",t,void 0,o),i}function q(e,t){const n=Reflect.has(e,t);return(0,r.yk)(t)&&F.has(t)||R(e,"has",t),n}function H(e){return R(e,"iterate",(0,r.kJ)(e)?"length":b),Reflect.ownKeys(e)}const W={get:L,set:J,deleteProperty:V,has:q,ownKeys:H},K={get:$,set(e,t){return!0},deleteProperty(e,t){return!0}},z=(0,r.l7)({},W,{get:M,set:B}),X=e=>e,Y=e=>Reflect.getPrototypeOf(e);function Z(e,t,n=!1,r=!1){e=e["__v_raw"];const o=Te(e),i=Te(t);t!==i&&!n&&R(o,"get",t),!n&&R(o,"get",i);const{has:s}=Y(o),c=r?X:n?je:Pe;return s.call(o,t)?c(e.get(t)Line truncated
/*! /*!
* vue-router v4.0.11 * vue-router v4.0.12
* (c) 2021 Eduardo San Martin Morote * (c) 2021 Eduardo San Martin Morote
* @license MIT * @license MIT
*/ */
const i="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag,s=e=>i?Symbol(e):"_vr_"+e,c=s("rvlm"),l=s("rvd"),u=s("r"),a=s("rl"),f=s("rvl"),p="undefined"!==typeof window;function d(e){return e.__esModule||i&&"Module"===e[Symbol.toStringTag]}const h=Object.assign;function v(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const g=()=>{};const m=/\/$/,y=e=>e.replace(m,"");function b(e,t,n="/"){let r,o={},i="",s="";const c=t.indexOf("?"),l=t.indexOf("#",c>-1?c:0);return c>-1&&(r=t.slice(0,c),i=t.slice(c+1,l>-1?l:t.length),o=e(i)),l>-1&&(r=r||t.slice(0,l),s=t.slice(l,t.length)),r=E(null!=r?r:t,n),{fullPath:r+(i&&"?")+i+s,path:r,query:o,hash:s}}function x(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function _(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function w(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&k(t.matched[r],n.matched[o])&&S(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function k(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function S(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!C(e[n],t[n]))return!1;return!0}function C(e,t){return Array.isArray(e)?O(e,t):Array.isArray(t)?O(t,e):e===t}function O(e,t){return Array.isArray(t)?e.length===t.length&&e.every(((e,n)=>e===t[n])):1===e.length&&e[0]===t}function E(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o,i,s=n.length-1;for(o=0;o<r.length;o++)if(i=r[o],1!==s&&"."!==i){if(".."!==i)break;s--}return n.slice(0,s).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}var R,A;(function(e){e["pop"]="pop",e["push"]="push"})(R||(R={})),function(e){e["back"]="back",e["forward"]="forward",e["unknown"]=""}(A||(A={}));function T(e){if(!e)if(p){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return"/"!==e[0]&&"#"!==e[0]&&(e="/"+e),y(e)}const I=/^[^#]+#/;function P(e,t){return e.replace(I,"#")+t}function j(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const F=()=>({left:window.pageXOffset,top:window.pageYOffset});function L(e){let t;if("el"in e){const n=e.el,r="string"===typeof n&&n.startsWith("#");0;const o="string"===typeof n?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=j(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}function M(e,t){const n=history.state?history.state.position-t:-1;return n+e}const $=new Map;function U(e,t){$.set(e,t)}function N(e){const t=$.get(e);return $.delete(e),t}let D=()=>location.protocol+"//"+location.host;function J(e,t){const{pathname:n,search:r,hash:o}=t,i=e.indexOf("#");if(i>-1){let t=o.includes(e.slice(i))?e.slice(i).length:1,n=o.slice(t);return"/"!==n[0]&&(n="/"+n),_(n,"")}const s=_(n,e);return s+r+o}function B(e,t,n,r){let o=[],i=[],s=null;const c=({state:i})=>{const c=J(e,location),l=n.value,u=t.value;let a=0;if(i){if(n.value=c,t.value=i,s&&s===l)return void(s=null);a=u?i.position-u.position:0}else r(c);o.forEach((e=>{e(n.value,l,{delta:a,type:R.pop,direction:a?a>0?A.forward:A.back:A.unknown})}))};function l(){s=n.value}function u(e){o.push(e);const t=()=>{const t=o.indexOf(e);t>-1&&o.splice(t,1)};return i.push(t),t}function a(){const{history:e}=window;e.state&&e.replaceState(h({},e.state,{scroll:F()}),"")}function f(){for(const e of i)e();i=[],window.removeEventListener("popstate",c),window.removeEventListener("beforeunload",a)}return window.addEventListener("popstate",c),window.addEventListener("beforeunload",a),{pauseListeners:l,listen:u,destroy:f}}function G(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?F():null}}function V(e){const{history:t,location:n}=window,r={value:J(e,n)},o={value:t.state};function i(r,i,s){const c=e.indexOf("#"),l=c>-1?(n.host&&document.querySelector("base")?e:e.slice(c))+r:D()+e+r;try{t[s?"replaceState":"pushState"](i,"",l),o.value=i}catch(u){console.error(u),n[s?"replace":"assign"](l)}}function s(e,n){const s=h({},t.state,G(o.value.back,e,o.value.forward,!0),n,{position:o.value.position});i(e,s,!0),r.value=e}function c(e,n){const s=h({},o.value,t.state,{forward:e,scroll:F()});i(s.current,s,!0);const c=h({},G(r.value,e,null),{position:s.position+1},n);i(e,c,!1),r.value=e}return o.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0),{location:r,state:o,push:c,replace:s}}function q(e){e=T(e);const t=V(e),n=B(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}const o=h({location:"",base:e,go:r,createHref:P.bind(null,e)},t,n);return Object.defineProperty(o,"loLine truncated const i="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag,s=e=>i?Symbol(e):"_vr_"+e,c=s("rvlm"),u=s("rvd"),l=s("r"),a=s("rl"),f=s("rvl"),p="undefined"!==typeof window;function d(e){return e.__esModule||i&&"Module"===e[Symbol.toStringTag]}const h=Object.assign;function v(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const g=()=>{};const m=/\/$/,y=e=>e.replace(m,"");function b(e,t,n="/"){let r,o={},i="",s="";const c=t.indexOf("?"),u=t.indexOf("#",c>-1?c:0);return c>-1&&(r=t.slice(0,c),i=t.slice(c+1,u>-1?u:t.length),o=e(i)),u>-1&&(r=r||t.slice(0,u),s=t.slice(u,t.length)),r=E(null!=r?r:t,n),{fullPath:r+(i&&"?")+i+s,path:r,query:o,hash:s}}function x(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function _(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function w(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&k(t.matched[r],n.matched[o])&&S(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function k(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function S(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!C(e[n],t[n]))return!1;return!0}function C(e,t){return Array.isArray(e)?O(e,t):Array.isArray(t)?O(t,e):e===t}function O(e,t){return Array.isArray(t)?e.length===t.length&&e.every(((e,n)=>e===t[n])):1===e.length&&e[0]===t}function E(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o,i,s=n.length-1;for(o=0;o<r.length;o++)if(i=r[o],1!==s&&"."!==i){if(".."!==i)break;s--}return n.slice(0,s).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}var R,A;(function(e){e["pop"]="pop",e["push"]="push"})(R||(R={})),function(e){e["back"]="back",e["forward"]="forward",e["unknown"]=""}(A||(A={}));function T(e){if(!e)if(p){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return"/"!==e[0]&&"#"!==e[0]&&(e="/"+e),y(e)}const I=/^[^#]+#/;function P(e,t){return e.replace(I,"#")+t}function j(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const F=()=>({left:window.pageXOffset,top:window.pageYOffset});function L(e){let t;if("el"in e){const n=e.el,r="string"===typeof n&&n.startsWith("#");0;const o="string"===typeof n?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=j(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}function M(e,t){const n=history.state?history.state.position-t:-1;return n+e}const $=new Map;function U(e,t){$.set(e,t)}function N(e){const t=$.get(e);return $.delete(e),t}let D=()=>location.protocol+"//"+location.host;function J(e,t){const{pathname:n,search:r,hash:o}=t,i=e.indexOf("#");if(i>-1){let t=o.includes(e.slice(i))?e.slice(i).length:1,n=o.slice(t);return"/"!==n[0]&&(n="/"+n),_(n,"")}const s=_(n,e);return s+r+o}function B(e,t,n,r){let o=[],i=[],s=null;const c=({state:i})=>{const c=J(e,location),u=n.value,l=t.value;let a=0;if(i){if(n.value=c,t.value=i,s&&s===u)return void(s=null);a=l?i.position-l.position:0}else r(c);o.forEach((e=>{e(n.value,u,{delta:a,type:R.pop,direction:a?a>0?A.forward:A.back:A.unknown})}))};function u(){s=n.value}function l(e){o.push(e);const t=()=>{const t=o.indexOf(e);t>-1&&o.splice(t,1)};return i.push(t),t}function a(){const{history:e}=window;e.state&&e.replaceState(h({},e.state,{scroll:F()}),"")}function f(){for(const e of i)e();i=[],window.removeEventListener("popstate",c),window.removeEventListener("beforeunload",a)}return window.addEventListener("popstate",c),window.addEventListener("beforeunload",a),{pauseListeners:u,listen:l,destroy:f}}function G(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?F():null}}function V(e){const{history:t,location:n}=window,r={value:J(e,n)},o={value:t.state};function i(r,i,s){const c=e.indexOf("#"),u=c>-1?(n.host&&document.querySelector("base")?e:e.slice(c))+r:D()+e+r;try{t[s?"replaceState":"pushState"](i,"",u),o.value=i}catch(l){console.error(l),n[s?"replace":"assign"](u)}}function s(e,n){const s=h({},t.state,G(o.value.back,e,o.value.forward,!0),n,{position:o.value.position});i(e,s,!0),r.value=e}function c(e,n){const s=h({},o.value,t.state,{forward:e,scroll:F()});i(s.current,s,!0);const c=h({},G(r.value,e,null),{position:s.position+1},n);i(e,c,!1),r.value=e}return o.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0),{location:r,state:o,push:c,replace:s}}function q(e){e=T(e);const t=V(e),n=B(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}const o=h({location:"",base:e,go:r,createHref:P.bind(null,e)},t,n);return Object.defineProperty(o,"loLine truncated