Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/goreleaser/goreleaser/v2.10.2/www/docs/static/schema.json
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2
Expand Down Expand Up @@ -55,21 +55,17 @@ changelog:
- "^docs:"
- "^test:"

brews:
homebrew_casks:
-
name: openstatus
directory: Formula
binary: openstatus
homepage: https://www.openstatus.dev
skip_upload: auto
description: "OpenStatus CLI"
test: |
system "#{bin}/openstatus --help"
extra_install: |
man1.install "openstatus-docs.1"
directory: Formula
manpage: openstatus-docs.1
repository:
# Repository owner.
#
# Templates: allowed.

owner: openstatusHQ

# Repository name.
Expand All @@ -80,3 +76,28 @@ brews:

branch: main
token: "{{ .Env.TAP_GITHUB_TOKEN }}"

# brews:
# -
# name: openstatus
# directory: Formula
# homepage: https://www.openstatus.dev
# skip_upload: auto
# test: |
# system "#{bin}/openstatus --help"
# extra_install: |
# man1.install "openstatus-docs.1"
# repository:
# # Repository owner.
# #
# # Templates: allowed.
# owner: openstatusHQ

# # Repository name.
# #
# # Templates: allowed.
# name: homebrew-cli


# branch: main
# token: "{{ .Env.TAP_GITHUB_TOKEN }}"
12 changes: 11 additions & 1 deletion cmd/openstatus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"fmt"
"log"
"os"

Expand All @@ -14,14 +15,23 @@ import (
func main() {
app := &cli.Command{
Name: "openstatus",
Suggest: true,
Usage: "This is OpenStatus Command Line Interface",
Description: "OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests. \n\nPlease report any issues at https://github.com/openstatusHQ/cli/issues/new",
UsageText: "openstatus [command] [flags]",
Description: "OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests.",
Version: "v0.0.4",
Commands: []*cli.Command{
monitors.MonitorsCmd(),
run.RunCmd(),
whoami.WhoamiCmd(),
},
EnableShellCompletion: true,

Action: func(ctx context.Context, cmd *cli.Command) error {
cli.ShowAppHelp(cmd)
fmt.Println("\n\nPlease report any issues at https://github.com/openstatusHQ/cli/issues/new")
return nil
},
}

if err := app.Run(context.Background(), os.Args); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/knadh/koanf/maps v0.1.2 // indirect
Expand All @@ -27,8 +26,7 @@ require (
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
github.com/olekukonko/ll v0.0.8 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/urfave/cli-docs/v3 v3.0.0-alpha6 // indirect
golang.org/x/sys v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
9 changes: 3 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -9,6 +7,7 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=
Expand Down Expand Up @@ -44,8 +43,6 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -55,8 +52,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli-docs/v3 v3.0.0-alpha6 h1:w/l/N0xw1rO/aHRIGXJ0lDwwYFOzilup1qGvIytP3BI=
github.com/urfave/cli-docs/v3 v3.0.0-alpha6/go.mod h1:p7Z4lg8FSTrPB9GTaNyTrK3ygffHZcK3w0cU2VE+mzU=
github.com/urfave/cli/v3 v3.0.0-alpha9.2 h1:CL8llQj3dGRLVQQzHxS+ZYRLanOuhyK1fXgLKD+qV+Y=
github.com/urfave/cli/v3 v3.0.0-alpha9.2/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -68,3 +63,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
54 changes: 27 additions & 27 deletions internal/config/monitor.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
package config

type Monitor struct {
// Whether the monitor is active
Active bool `json:"active,omitempty"`
// Assertions to run on the response
Assertions []Assertion `json:"assertions,omitempty"`
// Time in milliseconds to wait before marking the request as degraded
DegradedAfter int64 `json:"degradedAfter,omitempty"`
Description string `json:"description,omitempty"`
Frequency Frequency `json:"frequency"`
Kind CoordinateKind `json:"kind"`
// Name of the monitor
Name string `json:"name"`
// Whether the monitor is public
Public bool `json:"public,omitempty"`
Name string `json:"name" ,yaml:"name"`
Description string `json:"description,omitempty" ,yaml:"description,omitempty"`
Frequency Frequency `json:"frequency" ,yaml:"frequency"`
// Regions to run the request in
Regions []Region `json:"regions"`
// The HTTP Request we are sending
Request Request `json:"request"`
Regions []Region `json:"regions" ,yaml:"regions"`
// Whether the monitor is active
Active bool `json:"active"`
Kind CoordinateKind `json:"kind" ,yaml:"kind"`
// Number of retries to attempt
Retry int64 `json:"retry,omitempty"`
Retry int64 `json:"retry,omitempty" ,yaml:"retry,omitempty"`
// Whether the monitor is public
Public bool `json:"public,omitempty" ,yaml:"public,omitempty"`
// The HTTP Request we are sending
Request Request `json:"request" ,yaml:"request"`
// Time in milliseconds to wait before marking the request as degraded
DegradedAfter int64 `json:"degradedAfter,omitempty" ,yaml:"degradedAfter,omitempty"`
// Time in milliseconds to wait before marking the request as timed out
Timeout int64 `json:"timeout,omitempty"`
Timeout int64 `json:"timeout,omitempty" ,yaml:"timeout,omitempty"`
// Assertions to run on the response
Assertions []Assertion `json:"assertions,omitempty" ,yaml:"assertions,omitempty"`
}

type Assertion struct {
// Comparison operator
Compare Compare `json:"compare"`
Kind AssertionKind `json:"kind"`
Compare Compare `json:"compare" ,yaml:"compare"`
Kind AssertionKind `json:"kind" ,yaml:"kind"`
// Status code to assert
//
// Header value to assert
//
// Text body to assert
Target any `json:"target"`
Target any `json:"target" ,yaml:"target"`
// Header key to assert
Key string `json:"key,omitempty"`
Key string `json:"key,omitempty" ,yaml:"key,omitempty"`
}

// The HTTP Request we are sending
type Request struct {
// Body to send with the request
Body string `json:"body,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Method Method `json:"method,omitempty"`
Body string `json:"body,omitempty" ,yaml:"body,omitempty"`
Headers map[string]string `json:"headers,omitempty" ,yaml:"headers,omitempty"`
Method Method `json:"method,omitempty" ,yaml:"method,omitempty"`
// URL to request
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty" ,yaml:"url,omitempty"`
// Host to connect to
Host string `json:"host,omitempty"`
Host string `json:"host,omitempty" ,yaml:"host,omitempty"`
// Port to connect to
Port float64 `json:"port,omitempty"`
Port int64 `json:"port,omitempty" ,yaml:"port,omitempty"`
}

// Comparison operator
Expand Down
Loading