Compare commits
8 Commits
a35db2e05d
...
a4214b2b3f
Author | SHA1 | Date | |
---|---|---|---|
a4214b2b3f | |||
6ccb75f4fa | |||
b8a82b2836 | |||
78428a49fc | |||
42bc11bf1a | |||
44e3d534f6 | |||
1fbe3282c8 | |||
10a6342233 |
13
.changes/v0.4.0.md
Normal file
13
.changes/v0.4.0.md
Normal file
@ -0,0 +1,13 @@
|
||||
## v0.4.0 - 2023-09-08
|
||||
|
||||
### Added
|
||||
|
||||
* Added `scriptEnvFile` to command object that allows one to specify an environment file (or any file really) when a `scriptFile` is run. Inspired by the practice of keeping environment variables and scripts or commands seperate.
|
||||
* Basis for listing commands
|
||||
|
||||
### Changed
|
||||
|
||||
* BREAKING: Notifications object now takes the form of service.id, where service can be "mail" or "matrix" and id is a unique id for the service.
|
||||
* BREAKING: Since the change to the notifications object, cmd-lists' inner map key 'notifications' must be of the form service.id. id must be defined for that service. See notifications docs for aviliable services.
|
||||
* Config parser is now the simpler Koanf - Keys are now case-sensitive
|
||||
* Log size limited to 50 Mb
|
1
.frontmatter/database/taxonomyDb.json
Normal file
1
.frontmatter/database/taxonomyDb.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
- run: git fetch --force --tags
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
go-version: '1.26'
|
||||
cache: true
|
||||
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
||||
# on your needs.
|
||||
|
@ -1,4 +1,4 @@
|
||||
pipeline:
|
||||
steps:
|
||||
release:
|
||||
image: goreleaser/goreleaser
|
||||
commands:
|
||||
|
10
.woodpecker/go-lint.yml
Normal file
10
.woodpecker/go-lint.yml
Normal file
@ -0,0 +1,10 @@
|
||||
steps:
|
||||
build:
|
||||
image: golang
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
release:
|
||||
image: golangci/golangci-lint:v1.53.3
|
||||
commands:
|
||||
- golangci-lint run -v
|
@ -1,4 +1,4 @@
|
||||
pipeline:
|
||||
steps:
|
||||
build:
|
||||
image: klakegg/hugo:ext-debian-ci
|
||||
commands:
|
||||
|
8
Makefile
8
Makefile
@ -1,8 +0,0 @@
|
||||
build:
|
||||
go build
|
||||
|
||||
install:
|
||||
go install .
|
||||
|
||||
goreleaser-snapshot:
|
||||
goreleaser -f .goreleaser/gitea.yml release --snapshot --clean
|
@ -32,10 +32,10 @@ func Backup(cmd *cobra.Command, args []string) {
|
||||
backyConfOpts := backy.NewOpts(cfgFile, backy.AddCommandLists(cmdLists))
|
||||
backyConfOpts.InitConfig()
|
||||
|
||||
config := backy.ReadConfig(backyConfOpts)
|
||||
backy.ReadConfig(backyConfOpts)
|
||||
|
||||
config.RunListConfig("", backyConfOpts)
|
||||
for _, host := range config.Hosts {
|
||||
backyConfOpts.RunListConfig("")
|
||||
for _, host := range backyConfOpts.Hosts {
|
||||
if host.SshClient != nil {
|
||||
host.SshClient.Close()
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ var (
|
||||
func execute(cmd *cobra.Command, args []string) {
|
||||
|
||||
if len(args) < 1 {
|
||||
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 0, nil)
|
||||
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil)
|
||||
}
|
||||
|
||||
opts := backy.NewOpts(cfgFile, backy.AddCommands(args))
|
||||
|
39
cmd/list.go
Normal file
39
cmd/list.go
Normal file
@ -0,0 +1,39 @@
|
||||
// backup.go
|
||||
// Copyright (C) Andrew Woodlee 2023
|
||||
// License: Apache-2.0
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
listCmd = &cobra.Command{
|
||||
Use: "list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...]",
|
||||
Short: "Lists commands, lists, or hosts defined in config file.",
|
||||
Long: "Backup lists commands or groups defined in config file.\nUse the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed.",
|
||||
Run: List,
|
||||
}
|
||||
)
|
||||
|
||||
var listsToList []string
|
||||
|
||||
func init() {
|
||||
|
||||
listCmd.Flags().StringSliceVarP(&listsToList, "lists", "l", nil, "Accepts comma-separated names of command lists to list.")
|
||||
|
||||
}
|
||||
|
||||
func List(cmd *cobra.Command, args []string) {
|
||||
|
||||
opts := backy.NewOpts(cfgFile, backy.SetListsToSearch(cmdLists))
|
||||
|
||||
opts.InitConfig()
|
||||
|
||||
opts = backy.ReadConfig(opts)
|
||||
|
||||
opts.ListConfiguration()
|
||||
}
|
@ -36,5 +36,5 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file to read from")
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
|
||||
|
||||
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd)
|
||||
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd, listCmd)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const versionStr = "0.3.1"
|
||||
const versionStr = "0.4.0"
|
||||
|
||||
var (
|
||||
versionCmd = &cobra.Command{
|
||||
@ -32,9 +32,6 @@ func version(cmd *cobra.Command, args []string) {
|
||||
} else if vPre && !numOnly {
|
||||
fmt.Printf("v%s\n", versionStr)
|
||||
} else {
|
||||
if vPre && numOnly {
|
||||
fmt.Println("vpre flag and num flag both detected!")
|
||||
}
|
||||
fmt.Printf("Backy version: %s\n", versionStr)
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ Available Commands:
|
||||
cron Starts a scheduler that runs lists defined in config file.
|
||||
exec Runs commands defined in config file in order given.
|
||||
help Help about any command
|
||||
list Lists commands, lists, or hosts defined in config file.
|
||||
version Prints the version and exits
|
||||
|
||||
Flags:
|
||||
@ -91,7 +92,7 @@ Usage:
|
||||
|
||||
Flags:
|
||||
-h, --help help for version
|
||||
-n, --num Output the version number only. (default true)
|
||||
-n, --num Output the version number only.
|
||||
-V, --vpre Output the version with v prefixed.
|
||||
|
||||
Global Flags:
|
||||
@ -99,3 +100,20 @@ Global Flags:
|
||||
-v, --verbose Sets verbose level
|
||||
```
|
||||
|
||||
## list
|
||||
|
||||
```
|
||||
Backup lists commands or groups defined in config file.
|
||||
Use the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed.
|
||||
|
||||
Usage:
|
||||
backy list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...] [flags]
|
||||
|
||||
Flags:
|
||||
-h, --help help for list
|
||||
-l, --lists strings Accepts comma-separated names of command lists to list.
|
||||
|
||||
Global Flags:
|
||||
-f, --config string config file to read from
|
||||
-v, --verbose Sets verbose level
|
||||
```
|
||||
|
@ -16,8 +16,8 @@ The top-level object key can be anything you want but not the same as another.
|
||||
- test
|
||||
- test2
|
||||
notifications:
|
||||
- prod-email
|
||||
- matrix
|
||||
- mail.prod-email
|
||||
- matrix.sysadmin
|
||||
cron: "0 * * * * *"
|
||||
```
|
||||
|
||||
@ -25,9 +25,9 @@ The top-level object key can be anything you want but not the same as another.
|
||||
| --- | --- | --- | --- |
|
||||
| `order` | Defines the sequence of commands to execute | `[]string` | yes |
|
||||
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no |
|
||||
| `notifications` | The notification IDs to use on success and failure | `[]string` | no |
|
||||
| `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no |
|
||||
| `name` | Optional name of the list | `string` | no |
|
||||
| `cron` | Time at which to schedule the list. | `string` | no |
|
||||
| `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no |
|
||||
|
||||
### Order
|
||||
|
||||
@ -43,7 +43,7 @@ order:
|
||||
|
||||
Get command output when a notification is sent.
|
||||
|
||||
Is not required. Can be `true` or `false`.
|
||||
Is not required. Can be `true` or `false`. Default is `false`.
|
||||
|
||||
### Notifications
|
||||
|
||||
@ -57,29 +57,30 @@ Name is optional for logging. If name is not defined, name will be the object's
|
||||
|
||||
Backy also has a cron mode, so one can run `backy cron` and start a process that schedules jobs to run at times defined in the configuration file.
|
||||
|
||||
Adding `cron: 0 0 1 * * *` to a `cmd-configs` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
|
||||
Adding `cron: 0 0 1 * * *` to a `cmd-lists` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
|
||||
|
||||
{{% notice tip %}}
|
||||
Note: Backy uses the second field of cron, so add anything except * to the beginning of a regular cron expression.
|
||||
{{% /notice %}}
|
||||
|
||||
```yaml
|
||||
cmd-configs:
|
||||
cmds-to-run: # this can be any name you want
|
||||
cmd-lists:
|
||||
docker-container-backup: # this can be any name you want
|
||||
# all commands have to be defined
|
||||
order:
|
||||
- stop-docker-container
|
||||
- backup-docker-container-script
|
||||
- shell-cmd
|
||||
- hostname
|
||||
- start-docker-container
|
||||
notifications:
|
||||
- matrix
|
||||
name: backup-some-server
|
||||
- matrix.id
|
||||
name: backup-some-container
|
||||
cron: "0 0 1 * * *"
|
||||
hostname:
|
||||
name: hostname
|
||||
order:
|
||||
- hostname
|
||||
notifications:
|
||||
- prod-email
|
||||
- mail.prod-email
|
||||
```
|
||||
|
@ -7,6 +7,8 @@ The yaml top-level map can be any string.
|
||||
|
||||
The top-level name must be unique.
|
||||
|
||||
### Example Config
|
||||
|
||||
```yaml
|
||||
commands:
|
||||
stop-docker-container:
|
||||
@ -29,14 +31,15 @@ commands:
|
||||
|
||||
Values available for this section:
|
||||
|
||||
| name | description | type | required
|
||||
| name | notes | type | required
|
||||
| --- | --- | --- | --- |
|
||||
| `cmd` | Defines the command to execute | `string` | yes |
|
||||
| `args` | Defines the arguments to the command | `[]string` | no |
|
||||
| `environment` | Defines evironment variables for the command | `[]string` | no |
|
||||
| `type` | May be `scriptFile` or `script`. Runs script from local machine on remote | `string` | no |
|
||||
| `type` | May be `scriptFile` or `script`. Runs script from local machine on remote. Only applicable when `host` is defined. | `string` | no |
|
||||
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no |
|
||||
| `host` | If not specified, the command will execute locally. | `string` | no |
|
||||
| `scriptEnvFile` | When type is `scriptFile`, the script is appended to this file. | `string` | no |
|
||||
| `shell` | Only applicable when host is not specified | `string` | no |
|
||||
|
||||
#### cmd
|
||||
@ -86,13 +89,21 @@ If I assign a value to host as `host: web-prod` and don't specify this value in
|
||||
If shell is defined and host is NOT defined, the command will run in the specified shell.
|
||||
Make sure to escape any shell input.
|
||||
|
||||
### scriptEnvFile
|
||||
|
||||
Path to a file.
|
||||
|
||||
When type is `scriptFile`, the script is appended to this file.
|
||||
|
||||
This is useful for specifiing environment variables or other things so they don't have to be included in the script.
|
||||
|
||||
### type
|
||||
|
||||
May be `scriptFile` or `script`. Runs script from local machine on remote host.
|
||||
May be `scriptFile` or `script`. Runs script from local machine on remote host passed to the SSH session as standard input.
|
||||
|
||||
If `script` is specified, `cmd` is used as the script.
|
||||
If `type` is `script`, `cmd` is used as the script.
|
||||
|
||||
Script file is input as stdin to SSH.
|
||||
If `type` is `scriptFile`, cmd must be a file path.
|
||||
|
||||
### environment
|
||||
|
||||
@ -100,7 +111,7 @@ The environment variables support expansion:
|
||||
|
||||
- using escaped values `$VAR` or `${VAR}`
|
||||
|
||||
For now the variables have to be defined in an `.env` file in the same directory as the config file.
|
||||
For now, the variables have to be defined in an `.env` file in the same directory as the config file.
|
||||
|
||||
If using it with host specified, the SSH server has to be configured to accept those env variables.
|
||||
|
||||
|
@ -10,33 +10,33 @@ Notifications can be sent on command list completion and failure.
|
||||
|
||||
The supported platforms for notifications are email (SMTP) and [Matrix](https://matrix.org/).
|
||||
|
||||
Notifications are defined by type. The top-level object will be the id, and the `type` is required.
|
||||
Notifications are defined by service, with the current form following below. Ids must come after the service.
|
||||
|
||||
```yaml
|
||||
notifications:
|
||||
prod-email:
|
||||
type: mail
|
||||
host: yourhost.tld
|
||||
port: 587
|
||||
senderaddress: email@domain.tld
|
||||
to:
|
||||
- admin@domain.tld
|
||||
username: smtp-username@domain.tld
|
||||
password: your-password-here
|
||||
mail:
|
||||
prod-email:
|
||||
host: yourhost.tld
|
||||
port: 587
|
||||
senderaddress: email@domain.tld
|
||||
to:
|
||||
- admin@domain.tld
|
||||
username: smtp-username@domain.tld
|
||||
password: your-password-here
|
||||
|
||||
matrix:
|
||||
type: matrix
|
||||
home-server: your-home-server.tld
|
||||
room-id: room-id
|
||||
access-token: your-access-token
|
||||
user-id: your-user-id
|
||||
matrix:
|
||||
home-server: your-home-server.tld
|
||||
room-id: room-id
|
||||
access-token: your-access-token
|
||||
user-id: your-user-id
|
||||
```
|
||||
|
||||
Types recognized are `type: mail` and `type: matrix`
|
||||
Sections recognized are `mail` and `matrix`
|
||||
|
||||
The type's object and its keys are listed below.
|
||||
There must be a section with an id (eg. `mail.test-svr`) following one of these sections.
|
||||
|
||||
### type: mail
|
||||
### mail
|
||||
|
||||
| key | description | type
|
||||
| --- | --- | ---
|
||||
@ -47,7 +47,7 @@ The type's object and its keys are listed below.
|
||||
| `username` | SMTP username | `string`
|
||||
| `password` | SMTP password | `string`
|
||||
|
||||
### type: matrix
|
||||
### matrix
|
||||
|
||||
| key | description | type
|
||||
| --- | --- | ---
|
||||
|
@ -51,17 +51,17 @@
|
||||
"frontMatter.content.pageFolders": [
|
||||
{
|
||||
"title": "content",
|
||||
"path": "[[workspace]]/content",
|
||||
"originalPath": "[[workspace]]/content"
|
||||
"path": "[[workspace]]/docs/content",
|
||||
"originalPath": "[[workspace]]/docs/content"
|
||||
},
|
||||
{
|
||||
"title": "config-main",
|
||||
"path": "[[workspace]]/content/config",
|
||||
"originalPath": "[[workspace]]/content/config"
|
||||
"path": "[[workspace]]/docs/content/config",
|
||||
"originalPath": "[[workspace]]/docs/content/config"
|
||||
},
|
||||
{
|
||||
"title": "gs",
|
||||
"path": "[[workspace]]/content/getting-started"
|
||||
"path": "[[workspace]]/docs/content/getting-started"
|
||||
}
|
||||
]
|
||||
}
|
@ -50,4 +50,11 @@ eval "${BACKYCOMMAND} version -h >> _index.md"
|
||||
echo "\`\`\`" >> _index.md
|
||||
echo "" >> _index.md
|
||||
|
||||
echo "## list" >> _index.md
|
||||
echo "" >> _index.md
|
||||
echo "\`\`\`" >> _index.md
|
||||
eval "${BACKYCOMMAND} list -h >> _index.md"
|
||||
echo "\`\`\`" >> _index.md
|
||||
|
||||
|
||||
mv _index.md "$CLI_PAGE"
|
90
go.mod
90
go.mod
@ -1,74 +1,84 @@
|
||||
module git.andrewnw.xyz/CyberShell/backy
|
||||
|
||||
go 1.20
|
||||
go 1.26
|
||||
|
||||
require (
|
||||
github.com/go-co-op/gocron v1.18.0
|
||||
github.com/hashicorp/vault/api v1.9.0
|
||||
github.com/joho/godotenv v1.4.0
|
||||
github.com/go-co-op/gocron v1.33.1
|
||||
github.com/hashicorp/vault/api v1.10.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/kevinburke/ssh_config v1.2.0
|
||||
github.com/mattn/go-isatty v0.0.17
|
||||
github.com/nikoksr/notify v0.36.0
|
||||
github.com/knadh/koanf/parsers/yaml v0.1.0
|
||||
github.com/knadh/koanf/providers/file v0.1.0
|
||||
github.com/knadh/koanf/v2 v2.0.1
|
||||
github.com/mattn/go-isatty v0.0.19
|
||||
github.com/nikoksr/notify v0.41.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rs/zerolog v1.28.0
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/spf13/viper v1.14.0
|
||||
go.mongodb.org/mongo-driver v1.11.1
|
||||
golang.org/x/crypto v0.5.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
maunium.net/go/mautrix v0.13.0
|
||||
mvdan.cc/sh/v3 v3.6.0
|
||||
github.com/rs/zerolog v1.30.0
|
||||
github.com/spf13/cobra v1.7.0
|
||||
go.mongodb.org/mongo-driver v1.12.1
|
||||
golang.org/x/crypto v0.13.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
maunium.net/go/mautrix v0.16.0
|
||||
mvdan.cc/sh/v3 v3.7.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
|
||||
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.3.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.5 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible // indirect
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
github.com/klauspost/compress v1.16.7 // indirect
|
||||
github.com/knadh/koanf/maps v0.1.1 // indirect
|
||||
github.com/knadh/koanf/providers/structs v0.1.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||
github.com/spf13/afero v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/stretchr/testify v1.8.1 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/tidwall/gjson v1.14.4 // indirect
|
||||
github.com/stretchr/objx v0.5.1 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tidwall/gjson v1.16.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.1 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
golang.org/x/net v0.5.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.4.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
||||
go.mau.fi/util v0.0.0-20230906155759-14bad39a8718 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/net v0.15.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
maunium.net/go/maulogger/v2 v2.4.1 // indirect
|
||||
)
|
||||
|
242
go.sum
242
go.sum
@ -36,13 +36,12 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
|
||||
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
|
||||
github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M=
|
||||
github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
@ -51,8 +50,9 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
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=
|
||||
@ -64,14 +64,20 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
github.com/go-co-op/gocron v1.18.0 h1:SxTyJ5xnSN4byCq7b10LmmszFdxQlSQJod8s3gbnXxA=
|
||||
github.com/go-co-op/gocron v1.18.0/go.mod h1:sD/a0Aadtw5CpflUJ/lpP9Vfdk979Wl1Sg33HPHg0FY=
|
||||
github.com/go-co-op/gocron v1.30.1 h1:tjWUvJl5KrcwpkEkSXFSQFr4F9h5SfV/m4+RX0cV2fs=
|
||||
github.com/go-co-op/gocron v1.30.1/go.mod h1:39f6KNSGVOU1LO/ZOoZfcSxwlsJDQOKSu8erN0SH48Y=
|
||||
github.com/go-co-op/gocron v1.33.1 h1:wjX+Dg6Ae29a/f9BSQjY1Rl+jflTpW9aDyMqseCj78c=
|
||||
github.com/go-co-op/gocron v1.33.1/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo=
|
||||
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
|
||||
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@ -99,8 +105,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
@ -128,13 +135,14 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
|
||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||
@ -142,30 +150,33 @@ github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXc
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM=
|
||||
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts=
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
||||
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||
github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/vault/api v1.9.0 h1:ab7dI6W8DuCY7yCU8blo0UCYl2oHre/dloCmzMWg9w8=
|
||||
github.com/hashicorp/vault/api v1.9.0/go.mod h1:lloELQP4EyhjnCQhF8agKvWIVTmxbpEJj70b98959sM=
|
||||
github.com/hashicorp/vault/api v1.9.2 h1:YjkZLJ7K3inKgMZ0wzCU9OHqc+UqMQyXsPXnf3Cl2as=
|
||||
github.com/hashicorp/vault/api v1.9.2/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8=
|
||||
github.com/hashicorp/vault/api v1.10.0 h1:/US7sIjWN6Imp4o/Rj1Ce2Nr5bki/AXi9vAW3p2tOJQ=
|
||||
github.com/hashicorp/vault/api v1.10.0/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
|
||||
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
@ -173,14 +184,28 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X
|
||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs=
|
||||
github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
|
||||
github.com/knadh/koanf/parsers/yaml v0.1.0 h1:ZZ8/iGfRLvKSaMEECEBPM1HQslrZADk8fP1XFUxVI5w=
|
||||
github.com/knadh/koanf/parsers/yaml v0.1.0/go.mod h1:cvbUDC7AL23pImuQP0oRw/hPuccrNBS2bps8asS0CwY=
|
||||
github.com/knadh/koanf/providers/file v0.1.0 h1:fs6U7nrV58d3CFAFh8VTde8TM262ObYf3ODrc//Lp+c=
|
||||
github.com/knadh/koanf/providers/file v0.1.0/go.mod h1:rjJ/nHQl64iYCtAW2QQnF0eSmDEX/YZ/eNFj5yR6BvA=
|
||||
github.com/knadh/koanf/providers/structs v0.1.0 h1:wJRteCNn1qvLtE5h8KQBvLJovidSdntfdyIbbCzEyE0=
|
||||
github.com/knadh/koanf/providers/structs v0.1.0/go.mod h1:sw2YZ3txUcqA3Z27gPlmmBzWn1h8Nt9O6EP/91MkcWE=
|
||||
github.com/knadh/koanf/v2 v2.0.1 h1:1dYGITt1I23x8cfx8ZnldtezdyaZtfAuRtIFOiRzK7g=
|
||||
github.com/knadh/koanf/v2 v2.0.1/go.mod h1:ZeiIlIDXTE7w1lMT6UVcNiRAS2/rCeLn/GdLNvY1Dus=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
@ -190,23 +215,29 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/nikoksr/notify v0.36.0 h1:OeO/COtxZYLjtFuxBhpeVLfCFdGt48KKgOHKu43w8H0=
|
||||
github.com/nikoksr/notify v0.36.0/go.mod h1:U5h6rVleLTcAJASy7kRdD4vtsFBBxirWQKYX8NJ4jcw=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
|
||||
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
|
||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/nikoksr/notify v0.41.0 h1:4LGE41GpWdHX5M3Xo6DlWRwS2WLDbOq1Rk7IzY4vjmQ=
|
||||
github.com/nikoksr/notify v0.41.0/go.mod h1:FoE0UVPeopz1Vy5nm9vQZ+JVmYjEIjQgbFstbkw+cRE=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
@ -217,81 +248,108 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
|
||||
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 h1:3RPlVWzZ/PDqmVuf/FKHARG5EMid/tl7cv54Sw/QRVY=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
|
||||
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
|
||||
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
|
||||
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
|
||||
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
|
||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
|
||||
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU=
|
||||
github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As=
|
||||
github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
|
||||
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
|
||||
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 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
|
||||
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
|
||||
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
|
||||
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
|
||||
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.15.0 h1:5n/pM+v3r5ujuNl4YLZLsQ+UE5jlkLVm7jMzT5Mpolw=
|
||||
github.com/tidwall/gjson v1.15.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.16.0 h1:SyXa+dsSPpUlcwEDuKuEBJEz5vzTvOea+9rjyYodQFg=
|
||||
github.com/tidwall/gjson v1.16.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
|
||||
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
|
||||
github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
|
||||
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk=
|
||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.mongodb.org/mongo-driver v1.11.1 h1:QP0znIRTuL0jf1oBQoAoM0C6ZJfBK4kx0Uumtv1A7w8=
|
||||
go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.mau.fi/util v0.0.0-20230805171708-199bf3eec776 h1:VrxDCO/gLFHLQywGUsJzertrvt2mUEMrZPf4hEL/s18=
|
||||
go.mau.fi/util v0.0.0-20230805171708-199bf3eec776/go.mod h1:AxuJUMCxpzgJ5eV9JbPWKRH8aAJJidxetNdUj7qcb84=
|
||||
go.mau.fi/util v0.0.0-20230906155759-14bad39a8718 h1:hmm5bZqE0M8+Uvys0HJPCSbAIZIwYtTkBKYPjAWHuMM=
|
||||
go.mau.fi/util v0.0.0-20230906155759-14bad39a8718/go.mod h1:AxuJUMCxpzgJ5eV9JbPWKRH8aAJJidxetNdUj7qcb84=
|
||||
go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
|
||||
go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
|
||||
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
|
||||
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
|
||||
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
|
||||
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@ -302,6 +360,10 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
|
||||
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@ -325,6 +387,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -357,8 +420,11 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
||||
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@ -378,9 +444,9 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -419,12 +485,20 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -433,13 +507,17 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 h1:Dpdu/EMxGMFgq0CeYMh4fazTD2vtlZRYE7wyynxJb9U=
|
||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
@ -487,6 +565,7 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -580,18 +659,15 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
||||
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
|
||||
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
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=
|
||||
@ -602,10 +678,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
maunium.net/go/mautrix v0.13.0 h1:CRdpMFc1kDSNnCZMcqahR9/pkDy/vgRbd+fHnSCl6Yg=
|
||||
maunium.net/go/mautrix v0.13.0/go.mod h1:gYMQPsZ9lQpyKlVp+DGwOuc9LIcE/c8GZW2CvKHISgM=
|
||||
mvdan.cc/sh/v3 v3.6.0 h1:gtva4EXJ0dFNvl5bHjcUEvws+KRcDslT8VKheTYkbGU=
|
||||
mvdan.cc/sh/v3 v3.6.0/go.mod h1:U4mhtBLZ32iWhif5/lD+ygy1zrgaQhUu+XFy7C8+TTA=
|
||||
maunium.net/go/maulogger/v2 v2.4.1 h1:N7zSdd0mZkB2m2JtFUsiGTQQAdP0YeFWT7YMc80yAL8=
|
||||
maunium.net/go/maulogger/v2 v2.4.1/go.mod h1:omPuYwYBILeVQobz8uO3XC8DIRuEb5rXYlQSuqrbCho=
|
||||
maunium.net/go/mautrix v0.15.4 h1:Ug3n2Mo+9Yb94AjZTWJQSNHmShaksEzZi85EPl3S3P0=
|
||||
maunium.net/go/mautrix v0.15.4/go.mod h1:dBaDmsnOOBM4a+gKcgefXH73pHGXm+MCJzCs1dXFgrw=
|
||||
maunium.net/go/mautrix v0.16.0 h1:iUqCzJE2yqBC1ddAK6eAn159My8rLb4X8g4SFtQh2Dk=
|
||||
maunium.net/go/mautrix v0.16.0/go.mod h1:XAjE9pTSGcr6vXaiNgQGiip7tddJ8FQV1a29u2QdBG4=
|
||||
mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg=
|
||||
mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
@ -17,12 +17,13 @@ import (
|
||||
"embed"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
//go:embed templates/*.txt
|
||||
var templates embed.FS
|
||||
|
||||
var requiredKeys = []string{"commands", "cmd-configs"}
|
||||
var requiredKeys = []string{"commands"}
|
||||
|
||||
var Sprintf = fmt.Sprintf
|
||||
|
||||
@ -30,7 +31,7 @@ var Sprintf = fmt.Sprintf
|
||||
// The environment of local commands will be the machine's environment plus any extra
|
||||
// variables specified in the Env file or Environment.
|
||||
// Dir can also be specified for local commands.
|
||||
func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *ConfigOpts) ([]string, error) {
|
||||
func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([]string, error) {
|
||||
|
||||
var (
|
||||
outputArr []string
|
||||
@ -52,13 +53,13 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
command.Type = strings.TrimSpace(command.Type)
|
||||
|
||||
if command.Type != "" {
|
||||
log.Info().Str("Command", fmt.Sprintf("Running script %s on host %s", command.Cmd, *command.Host)).Send()
|
||||
cmdCtxLogger.Info().Str("Command", fmt.Sprintf("Running script %s on host %s", command.Cmd, *command.Host)).Send()
|
||||
} else {
|
||||
log.Info().Str("Command", fmt.Sprintf("Running command %s %s on host %s", command.Cmd, ArgsStr, *command.Host)).Send()
|
||||
cmdCtxLogger.Info().Str("Command", fmt.Sprintf("Running command %s %s on host %s", command.Cmd, ArgsStr, *command.Host)).Send()
|
||||
}
|
||||
|
||||
if command.RemoteHost.SshClient == nil {
|
||||
err := command.RemoteHost.ConnectToSSHHost(opts, backyConf)
|
||||
err := command.RemoteHost.ConnectToSSHHost(opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -67,7 +68,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
|
||||
// Retry connecting to host; if that fails, error. If it does not fail, try to create new session
|
||||
if err != nil {
|
||||
connErr := command.RemoteHost.ConnectToSSHHost(opts, backyConf)
|
||||
connErr := command.RemoteHost.ConnectToSSHHost(opts)
|
||||
if connErr != nil {
|
||||
return nil, fmt.Errorf("error creating session: %v, and error creating new connection to host: %v", err, connErr)
|
||||
}
|
||||
@ -80,7 +81,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
|
||||
defer commandSession.Close()
|
||||
|
||||
injectEnvIntoSSH(envVars, commandSession, opts, log)
|
||||
injectEnvIntoSSH(envVars, commandSession, opts, cmdCtxLogger)
|
||||
cmd := command.Cmd
|
||||
for _, a := range command.Args {
|
||||
cmd += " " + a
|
||||
@ -95,6 +96,13 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
commandSession.Stderr = cmdOutWriters
|
||||
if command.Type != "" {
|
||||
|
||||
// did the program panic while writing to the buffer?
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
cmdCtxLogger.Info().Msg(fmt.Sprintf("panic occured writing to buffer: %x", err))
|
||||
}
|
||||
}()
|
||||
|
||||
if command.Type == "script" {
|
||||
script := bytes.NewBufferString(cmd + "\n")
|
||||
|
||||
@ -112,7 +120,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if str, ok := outMap["output"].(string); ok {
|
||||
outputArr = append(outputArr, str)
|
||||
}
|
||||
log.Info().Fields(outMap).Send()
|
||||
cmdCtxLogger.Info().Fields(outMap).Send()
|
||||
}
|
||||
return outputArr, err
|
||||
}
|
||||
@ -130,8 +138,31 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
return outputArr, nil
|
||||
}
|
||||
if command.Type == "scriptFile" {
|
||||
var buffer bytes.Buffer
|
||||
var dirErr error
|
||||
var (
|
||||
buffer bytes.Buffer
|
||||
scriptEnvFileBuffer bytes.Buffer
|
||||
scriptFileBuffer bytes.Buffer
|
||||
dirErr error
|
||||
scriptEnvFilePresent bool
|
||||
)
|
||||
|
||||
if command.ScriptEnvFile != "" {
|
||||
command.ScriptEnvFile, dirErr = resolveDir(command.ScriptEnvFile)
|
||||
if dirErr != nil {
|
||||
return nil, dirErr
|
||||
}
|
||||
file, err := os.Open(command.ScriptEnvFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
_, err = io.Copy(&scriptEnvFileBuffer, file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scriptEnvFilePresent = true
|
||||
}
|
||||
|
||||
command.Cmd, dirErr = resolveDir(command.Cmd)
|
||||
if dirErr != nil {
|
||||
return nil, dirErr
|
||||
@ -140,12 +171,32 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
_, err = io.Copy(&buffer, file)
|
||||
_, err = io.Copy(&scriptFileBuffer, file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
if scriptEnvFilePresent {
|
||||
_, err := buffer.WriteString(scriptEnvFileBuffer.String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// write newline
|
||||
buffer.WriteByte(0x0A)
|
||||
|
||||
_, err = buffer.WriteString(scriptFileBuffer.String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
_, err = io.Copy(&buffer, file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
script := &buffer
|
||||
|
||||
commandSession.Stdin = script
|
||||
@ -161,7 +212,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if str, ok := outMap["output"].(string); ok {
|
||||
outputArr = append(outputArr, str)
|
||||
}
|
||||
log.Info().Fields(outMap).Send()
|
||||
cmdCtxLogger.Info().Fields(outMap).Send()
|
||||
}
|
||||
return outputArr, err
|
||||
}
|
||||
@ -174,7 +225,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if str, ok := outMap["output"].(string); ok {
|
||||
outputArr = append(outputArr, str)
|
||||
}
|
||||
log.Info().Fields(outMap).Send()
|
||||
cmdCtxLogger.Info().Fields(outMap).Send()
|
||||
}
|
||||
return outputArr, nil
|
||||
}
|
||||
@ -190,18 +241,18 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if str, ok := outMap["output"].(string); ok {
|
||||
outputArr = append(outputArr, str)
|
||||
}
|
||||
log.Info().Fields(outMap).Send()
|
||||
cmdCtxLogger.Info().Fields(outMap).Send()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error().Err(fmt.Errorf("error when running cmd: %s: %w", command.Cmd, err)).Send()
|
||||
cmdCtxLogger.Error().Err(fmt.Errorf("error when running cmd: %s: %w", command.Cmd, err)).Send()
|
||||
return outputArr, err
|
||||
}
|
||||
} else {
|
||||
|
||||
var err error
|
||||
if command.Shell != "" {
|
||||
log.Info().Str("Command", fmt.Sprintf("Running command %s %s on local machine in %s", command.Cmd, ArgsStr, command.Shell)).Send()
|
||||
cmdCtxLogger.Info().Str("Command", fmt.Sprintf("Running command %s %s on local machine in %s", command.Cmd, ArgsStr, command.Shell)).Send()
|
||||
|
||||
ArgsStr = fmt.Sprintf("%s %s", command.Cmd, ArgsStr)
|
||||
|
||||
@ -210,7 +261,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if command.Dir != nil {
|
||||
localCMD.Dir = *command.Dir
|
||||
}
|
||||
injectEnvIntoLocalCMD(envVars, localCMD, log)
|
||||
injectEnvIntoLocalCMD(envVars, localCMD, cmdCtxLogger)
|
||||
|
||||
cmdOutWriters = io.MultiWriter(&cmdOutBuf)
|
||||
|
||||
@ -236,12 +287,12 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error().Err(fmt.Errorf("error when running cmd %s: %w", command.Cmd, err)).Send()
|
||||
cmdCtxLogger.Error().Err(fmt.Errorf("error when running cmd %s: %w", command.Cmd, err)).Send()
|
||||
return outputArr, err
|
||||
}
|
||||
return outputArr, nil
|
||||
}
|
||||
log.Info().Str("Command", fmt.Sprintf("Running command %s %s on local machine", command.Cmd, ArgsStr)).Send()
|
||||
cmdCtxLogger.Info().Str("Command", fmt.Sprintf("Running command %s %s on local machine", command.Cmd, ArgsStr)).Send()
|
||||
|
||||
localCMD := exec.Command(command.Cmd, command.Args...)
|
||||
if command.Dir != nil {
|
||||
@ -249,7 +300,7 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
}
|
||||
// fmt.Printf("%v\n", envVars.env)
|
||||
|
||||
injectEnvIntoLocalCMD(envVars, localCMD, log)
|
||||
injectEnvIntoLocalCMD(envVars, localCMD, cmdCtxLogger)
|
||||
cmdOutWriters = io.MultiWriter(&cmdOutBuf)
|
||||
// fmt.Printf("%v\n", localCMD.Environ())
|
||||
|
||||
@ -268,46 +319,46 @@ func (command *Command) RunCmd(log zerolog.Logger, backyConf *ConfigFile, opts *
|
||||
if str, ok := outMap["output"].(string); ok {
|
||||
outputArr = append(outputArr, str)
|
||||
}
|
||||
log.Info().Fields(outMap).Send()
|
||||
cmdCtxLogger.Info().Fields(outMap).Send()
|
||||
}
|
||||
if err != nil {
|
||||
log.Error().Err(fmt.Errorf("error when running cmd %s: %w", command.Cmd, err)).Send()
|
||||
cmdCtxLogger.Error().Err(fmt.Errorf("error when running cmd %s: %w", command.Cmd, err)).Send()
|
||||
return outputArr, err
|
||||
}
|
||||
}
|
||||
return outputArr, nil
|
||||
}
|
||||
|
||||
func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, config *ConfigFile, results chan<- string, opts *ConfigOpts) {
|
||||
func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, results chan<- string, opts *ConfigOpts) {
|
||||
|
||||
for list := range jobs {
|
||||
fieldsMap := make(map[string]interface{})
|
||||
fieldsMap["list"] = list.Name
|
||||
|
||||
cmdLog := config.Logger.Info()
|
||||
cmdLog := opts.Logger.Info()
|
||||
|
||||
var count int
|
||||
var cmdsRan []string
|
||||
var outStructArr []outStruct
|
||||
|
||||
for _, cmd := range list.Order {
|
||||
currentCmd := config.Cmds[cmd].Cmd
|
||||
currentCmd := opts.Cmds[cmd].Cmd
|
||||
|
||||
fieldsMap["cmd"] = config.Cmds[cmd].Cmd
|
||||
cmdToRun := config.Cmds[cmd]
|
||||
fieldsMap["cmd"] = opts.Cmds[cmd].Cmd
|
||||
cmdToRun := opts.Cmds[cmd]
|
||||
cmdLog.Fields(fieldsMap).Send()
|
||||
|
||||
cmdLogger := config.Logger.With().
|
||||
cmdLogger := opts.Logger.With().
|
||||
Str("backy-cmd", cmd).Str("Host", "local machine").
|
||||
Logger()
|
||||
|
||||
if cmdToRun.Host != nil {
|
||||
cmdLogger = config.Logger.With().
|
||||
cmdLogger = opts.Logger.With().
|
||||
Str("backy-cmd", cmd).Str("Host", *cmdToRun.Host).
|
||||
Logger()
|
||||
}
|
||||
|
||||
outputArr, runOutErr := cmdToRun.RunCmd(cmdLogger, config, opts)
|
||||
outputArr, runOutErr := cmdToRun.RunCmd(cmdLogger, opts)
|
||||
if list.NotifyConfig != nil {
|
||||
|
||||
if cmdToRun.GetOutput || list.GetOutput {
|
||||
@ -330,7 +381,7 @@ func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, config *ConfigF
|
||||
errStruct["listName"] = list.Name
|
||||
errStruct["Command"] = currentCmd
|
||||
errStruct["Cmd"] = cmd
|
||||
errStruct["Args"] = config.Cmds[cmd].Args
|
||||
errStruct["Args"] = opts.Cmds[cmd].Args
|
||||
errStruct["Err"] = runOutErr
|
||||
errStruct["CmdsRan"] = cmdsRan
|
||||
errStruct["Output"] = outputArr
|
||||
@ -340,17 +391,17 @@ func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, config *ConfigF
|
||||
tmpErr := msgTemps.err.Execute(&errMsg, errStruct)
|
||||
|
||||
if tmpErr != nil {
|
||||
config.Logger.Err(tmpErr).Send()
|
||||
opts.Logger.Err(tmpErr).Send()
|
||||
}
|
||||
|
||||
notifySendErr := list.NotifyConfig.Send(context.Background(), fmt.Sprintf("List %s failed on command %s ", list.Name, cmd), errMsg.String())
|
||||
notifySendErr := list.NotifyConfig.Send(context.Background(), fmt.Sprintf("List %s failed", list.Name), errMsg.String())
|
||||
|
||||
if notifySendErr != nil {
|
||||
config.Logger.Err(notifySendErr).Send()
|
||||
opts.Logger.Err(notifySendErr).Send()
|
||||
}
|
||||
}
|
||||
|
||||
config.Logger.Err(runOutErr).Send()
|
||||
opts.Logger.Err(runOutErr).Send()
|
||||
|
||||
break
|
||||
} else {
|
||||
@ -370,14 +421,14 @@ func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, config *ConfigF
|
||||
tmpErr := msgTemps.success.Execute(&successMsg, successStruct)
|
||||
|
||||
if tmpErr != nil {
|
||||
config.Logger.Err(tmpErr).Send()
|
||||
opts.Logger.Err(tmpErr).Send()
|
||||
break
|
||||
}
|
||||
|
||||
err := list.NotifyConfig.Send(context.Background(), fmt.Sprintf("List %s succeded", list.Name), successMsg.String())
|
||||
|
||||
if err != nil {
|
||||
config.Logger.Err(err).Send()
|
||||
opts.Logger.Err(err).Send()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -392,22 +443,22 @@ func cmdListWorker(msgTemps *msgTemplates, jobs <-chan *CmdList, config *ConfigF
|
||||
}
|
||||
|
||||
// RunListConfig runs a command list from the ConfigFile.
|
||||
func (config *ConfigFile) RunListConfig(cron string, opts *ConfigOpts) {
|
||||
func (opts *ConfigOpts) RunListConfig(cron string) {
|
||||
mTemps := &msgTemplates{
|
||||
err: template.Must(template.New("error.txt").ParseFS(templates, "templates/error.txt")),
|
||||
success: template.Must(template.New("success.txt").ParseFS(templates, "templates/success.txt")),
|
||||
}
|
||||
configListsLen := len(config.CmdConfigLists)
|
||||
configListsLen := len(opts.CmdConfigLists)
|
||||
listChan := make(chan *CmdList, configListsLen)
|
||||
results := make(chan string)
|
||||
|
||||
// This starts up list workers, initially blocked
|
||||
// because there are no jobs yet.
|
||||
for w := 1; w <= configListsLen; w++ {
|
||||
go cmdListWorker(mTemps, listChan, config, results, opts)
|
||||
go cmdListWorker(mTemps, listChan, results, opts)
|
||||
}
|
||||
|
||||
for listName, cmdConfig := range config.CmdConfigLists {
|
||||
for listName, cmdConfig := range opts.CmdConfigLists {
|
||||
if cmdConfig.Name == "" {
|
||||
cmdConfig.Name = listName
|
||||
}
|
||||
@ -425,26 +476,26 @@ func (config *ConfigFile) RunListConfig(cron string, opts *ConfigOpts) {
|
||||
<-results
|
||||
}
|
||||
|
||||
config.closeHostConnections()
|
||||
opts.closeHostConnections()
|
||||
}
|
||||
|
||||
func (config *ConfigFile) ExecuteCmds(opts *ConfigOpts) {
|
||||
func (config *ConfigOpts) ExecuteCmds(opts *ConfigOpts) {
|
||||
for _, cmd := range opts.executeCmds {
|
||||
cmdToRun := config.Cmds[cmd]
|
||||
cmdLogger := config.Logger.With().
|
||||
cmdToRun := opts.Cmds[cmd]
|
||||
cmdLogger := opts.Logger.With().
|
||||
Str("backy-cmd", cmd).
|
||||
Logger()
|
||||
_, runErr := cmdToRun.RunCmd(cmdLogger, config, opts)
|
||||
_, runErr := cmdToRun.RunCmd(cmdLogger, opts)
|
||||
if runErr != nil {
|
||||
config.Logger.Err(runErr).Send()
|
||||
opts.Logger.Err(runErr).Send()
|
||||
}
|
||||
}
|
||||
|
||||
config.closeHostConnections()
|
||||
opts.closeHostConnections()
|
||||
|
||||
}
|
||||
|
||||
func (c *ConfigFile) closeHostConnections() {
|
||||
func (c *ConfigOpts) closeHostConnections() {
|
||||
for _, host := range c.Hosts {
|
||||
c.Logger.Info().Str("server", host.HostName)
|
||||
if host.isProxyHost {
|
||||
|
@ -10,40 +10,58 @@ import (
|
||||
|
||||
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||
vault "github.com/hashicorp/vault/api"
|
||||
"github.com/knadh/koanf/parsers/yaml"
|
||||
"github.com/knadh/koanf/providers/file"
|
||||
"github.com/knadh/koanf/v2"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func (opts *ConfigOpts) InitConfig() {
|
||||
if opts.viper != nil {
|
||||
return
|
||||
}
|
||||
backyViper := viper.New()
|
||||
var homeDir string
|
||||
var homeDirErr error
|
||||
var backyHomeConfDir string
|
||||
var configFiles []string
|
||||
|
||||
if strings.TrimSpace(opts.ConfigFilePath) != "" {
|
||||
func (opts *ConfigOpts) InitConfig() {
|
||||
|
||||
homeDir, homeDirErr = os.UserHomeDir()
|
||||
if homeDirErr != nil {
|
||||
fmt.Println(homeDirErr)
|
||||
}
|
||||
backyHomeConfDir = homeDir + "/.config/backy/"
|
||||
configFiles = []string{"./backy.yml", "./backy.yaml", backyHomeConfDir + "backy.yml", backyHomeConfDir + "backy.yaml"}
|
||||
backyKoanf := koanf.New(".")
|
||||
opts.ConfigFilePath = strings.TrimSpace(opts.ConfigFilePath)
|
||||
if opts.ConfigFilePath != "" {
|
||||
err := testFile(opts.ConfigFilePath)
|
||||
if err != nil {
|
||||
logging.ExitWithMSG(fmt.Sprintf("Could not open config file %s: %v", opts.ConfigFilePath, err), 1, nil)
|
||||
}
|
||||
backyViper.SetConfigFile(opts.ConfigFilePath)
|
||||
|
||||
if err := backyKoanf.Load(file.Provider(opts.ConfigFilePath), yaml.Parser()); err != nil {
|
||||
logging.ExitWithMSG(fmt.Sprintf("error loading config: %v", err), 1, &opts.Logger)
|
||||
}
|
||||
} else {
|
||||
backyViper.SetConfigName("backy.yml") // name of config file (with extension)
|
||||
backyViper.SetConfigName("backy.yaml") // name of config file (with extension)
|
||||
backyViper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name
|
||||
backyViper.AddConfigPath(".") // optionally look for config in the working directory
|
||||
backyViper.AddConfigPath("$HOME/.config/backy") // call multiple times to add many search paths
|
||||
|
||||
cFileFalures := 0
|
||||
for _, c := range configFiles {
|
||||
if err := backyKoanf.Load(file.Provider(c), yaml.Parser()); err != nil {
|
||||
cFileFalures++
|
||||
} else {
|
||||
opts.ConfigFilePath = c
|
||||
break
|
||||
}
|
||||
}
|
||||
if cFileFalures == len(configFiles) {
|
||||
logging.ExitWithMSG(fmt.Sprintf("could not find a config file. Put one in the following paths: %v", configFiles), 1, &opts.Logger)
|
||||
}
|
||||
}
|
||||
err := backyViper.ReadInConfig() // Find and read the config file
|
||||
if err != nil { // Handle errors reading the config file
|
||||
msg := fmt.Sprintf("fatal error reading config file %s: %v", backyViper.ConfigFileUsed(), err)
|
||||
logging.ExitWithMSG(msg, 1, nil)
|
||||
}
|
||||
opts.viper = backyViper
|
||||
|
||||
opts.koanf = backyKoanf
|
||||
}
|
||||
|
||||
// ReadConfig validates and reads the config file.
|
||||
func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
func ReadConfig(opts *ConfigOpts) *ConfigOpts {
|
||||
|
||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
||||
os.Setenv("BACKY_TERM", "enabled")
|
||||
@ -53,44 +71,38 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
os.Setenv("BACKY_TERM", "disabled")
|
||||
}
|
||||
|
||||
backyConfigFile := NewConfig()
|
||||
backyViper := opts.viper
|
||||
backyKoanf := opts.koanf
|
||||
|
||||
opts.loadEnv()
|
||||
// envFileInConfigDir := fmt.Sprintf("%s/.env", path.Dir(backyViper.ConfigFileUsed()))
|
||||
|
||||
// load the .env file in config file directory
|
||||
// _ = godotenv.Load(envFileInConfigDir)
|
||||
|
||||
if backyViper.GetBool(getNestedConfig("logging", "cmd-std-out")) {
|
||||
if backyKoanf.Bool(getNestedConfig("logging", "cmd-std-out")) {
|
||||
os.Setenv("BACKY_STDOUT", "enabled")
|
||||
}
|
||||
|
||||
CheckConfigValues(backyViper)
|
||||
CheckConfigValues(backyKoanf, opts.ConfigFilePath)
|
||||
for _, c := range opts.executeCmds {
|
||||
if !backyViper.IsSet(getCmdFromConfig(c)) {
|
||||
logging.ExitWithMSG(Sprintf("command %s is not in config file %s", c, backyViper.ConfigFileUsed()), 1, nil)
|
||||
if !backyKoanf.Exists(getCmdFromConfig(c)) {
|
||||
logging.ExitWithMSG(Sprintf("command %s is not in config file %s", c, opts.ConfigFilePath), 1, nil)
|
||||
}
|
||||
}
|
||||
|
||||
for _, l := range opts.executeLists {
|
||||
if !backyViper.IsSet(getCmdListFromConfig(l)) {
|
||||
if !backyKoanf.Exists(getCmdListFromConfig(l)) {
|
||||
logging.ExitWithMSG(Sprintf("list %s not found", l), 1, nil)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// backyLoggingOpts *viper.Viper
|
||||
verbose bool
|
||||
logFile string
|
||||
)
|
||||
|
||||
verbose = backyViper.GetBool(getLoggingKeyFromConfig("verbose"))
|
||||
verbose = backyKoanf.Bool(getLoggingKeyFromConfig("verbose"))
|
||||
|
||||
logFile = fmt.Sprintf("%s/backy.log", path.Dir(backyViper.ConfigFileUsed()))
|
||||
if backyViper.IsSet(getLoggingKeyFromConfig("file")) {
|
||||
logFile = backyViper.GetString(getLoggingKeyFromConfig("file"))
|
||||
logFile = fmt.Sprintf("%s/backy.log", path.Dir(opts.ConfigFilePath))
|
||||
if backyKoanf.Exists(getLoggingKeyFromConfig("file")) {
|
||||
logFile = backyKoanf.String(getLoggingKeyFromConfig("file"))
|
||||
}
|
||||
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
|
||||
if verbose {
|
||||
@ -99,7 +111,7 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
os.Setenv("BACKY_LOGLEVEL", Sprintf("%v", globalLvl))
|
||||
}
|
||||
|
||||
consoleLoggingDisabled := backyViper.GetBool(getLoggingKeyFromConfig("console-disabled"))
|
||||
consoleLoggingDisabled := backyKoanf.Bool(getLoggingKeyFromConfig("console-disabled"))
|
||||
|
||||
os.Setenv("BACKY_CONSOLE_LOGGING", "enabled")
|
||||
// Other qualifiers can go here as well
|
||||
@ -111,42 +123,30 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
|
||||
log := zerolog.New(writers).With().Timestamp().Logger()
|
||||
|
||||
backyConfigFile.Logger = log
|
||||
opts.Logger = log
|
||||
|
||||
log.Info().Str("config file", backyViper.ConfigFileUsed()).Send()
|
||||
commandsMap := backyViper.GetStringMapString("commands")
|
||||
commandsMapViper := backyViper.Sub("commands")
|
||||
unmarshalErr := commandsMapViper.Unmarshal(&backyConfigFile.Cmds)
|
||||
log.Info().Str("config file", opts.ConfigFilePath).Send()
|
||||
|
||||
unmarshalErr := backyKoanf.UnmarshalWithConf("commands", &opts.Cmds, koanf.UnmarshalConf{Tag: "yaml"})
|
||||
if unmarshalErr != nil {
|
||||
panic(fmt.Errorf("error unmarshalling cmds struct: %w", unmarshalErr))
|
||||
}
|
||||
|
||||
hostConfigsMap := make(map[string]*viper.Viper)
|
||||
|
||||
for cmdName, cmdConf := range backyConfigFile.Cmds {
|
||||
for cmdName, cmdConf := range opts.Cmds {
|
||||
envFileErr := testFile(cmdConf.Env)
|
||||
if envFileErr != nil {
|
||||
backyConfigFile.Logger.Info().Str("cmd", cmdName).Err(envFileErr).Send()
|
||||
opts.Logger.Info().Str("cmd", cmdName).Err(envFileErr).Send()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
expandEnvVars(opts.backyEnv, cmdConf.Environment)
|
||||
|
||||
host := cmdConf.Host
|
||||
if host != nil {
|
||||
if backyViper.IsSet(getNestedConfig("hosts", *host)) {
|
||||
hostconfig := backyViper.Sub(getNestedConfig("hosts", *host))
|
||||
hostConfigsMap[*host] = hostconfig
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hostsMapViper := backyViper.Sub("hosts")
|
||||
unmarshalErr = hostsMapViper.Unmarshal(&backyConfigFile.Hosts)
|
||||
unmarshalErr = backyKoanf.UnmarshalWithConf("hosts", &opts.Hosts, koanf.UnmarshalConf{Tag: "yaml"})
|
||||
if unmarshalErr != nil {
|
||||
panic(fmt.Errorf("error unmarshalling hosts struct: %w", unmarshalErr))
|
||||
}
|
||||
for hostConfigName, host := range backyConfigFile.Hosts {
|
||||
for hostConfigName, host := range opts.Hosts {
|
||||
if host.Host == "" {
|
||||
host.Host = hostConfigName
|
||||
}
|
||||
@ -155,7 +155,7 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
if len(proxyHosts) > 1 {
|
||||
for hostNum, h := range proxyHosts {
|
||||
if hostNum > 1 {
|
||||
proxyHost, defined := backyConfigFile.Hosts[h]
|
||||
proxyHost, defined := opts.Hosts[h]
|
||||
if defined {
|
||||
host.ProxyHost = append(host.ProxyHost, proxyHost)
|
||||
} else {
|
||||
@ -163,7 +163,7 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
host.ProxyHost = append(host.ProxyHost, newProxy)
|
||||
}
|
||||
} else {
|
||||
proxyHost, defined := backyConfigFile.Hosts[h]
|
||||
proxyHost, defined := opts.Hosts[h]
|
||||
if defined {
|
||||
host.ProxyHost = append(host.ProxyHost, proxyHost)
|
||||
} else {
|
||||
@ -173,7 +173,7 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
proxyHost, defined := backyConfigFile.Hosts[proxyHosts[0]]
|
||||
proxyHost, defined := opts.Hosts[proxyHosts[0]]
|
||||
if defined {
|
||||
host.ProxyHost = append(host.ProxyHost, proxyHost)
|
||||
} else {
|
||||
@ -184,33 +184,29 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
}
|
||||
}
|
||||
|
||||
cmdListCfg := backyViper.Sub("cmd-configs")
|
||||
unmarshalErr = cmdListCfg.Unmarshal(&backyConfigFile.CmdConfigLists)
|
||||
if unmarshalErr != nil {
|
||||
panic(fmt.Errorf("error unmarshalling cmd list struct: %w", unmarshalErr))
|
||||
if backyKoanf.Exists("cmd-lists") {
|
||||
unmarshalErr = backyKoanf.UnmarshalWithConf("cmd-lists", &opts.CmdConfigLists, koanf.UnmarshalConf{Tag: "yaml"})
|
||||
if unmarshalErr != nil {
|
||||
logging.ExitWithMSG((fmt.Sprintf("error unmarshalling cmd list struct: %v", unmarshalErr)), 1, &opts.Logger)
|
||||
}
|
||||
}
|
||||
|
||||
var cmdNotFoundSliceErr []error
|
||||
for cmdListName, cmdList := range backyConfigFile.CmdConfigLists {
|
||||
for cmdListName, cmdList := range opts.CmdConfigLists {
|
||||
if opts.useCron {
|
||||
cron := strings.TrimSpace(cmdList.Cron)
|
||||
if cron == "" {
|
||||
delete(backyConfigFile.CmdConfigLists, cmdListName)
|
||||
delete(opts.CmdConfigLists, cmdListName)
|
||||
}
|
||||
}
|
||||
for _, cmdInList := range cmdList.Order {
|
||||
_, cmdNameFound := backyConfigFile.Cmds[cmdInList]
|
||||
_, cmdNameFound := opts.Cmds[cmdInList]
|
||||
if !cmdNameFound {
|
||||
cmdNotFoundStr := fmt.Sprintf("command %s in list %s is not defined in config file", cmdInList, cmdListName)
|
||||
cmdNotFoundStr := fmt.Sprintf("command %s in list %s is not defined in commands section in config file", cmdInList, cmdListName)
|
||||
cmdNotFoundErr := errors.New(cmdNotFoundStr)
|
||||
cmdNotFoundSliceErr = append(cmdNotFoundSliceErr, cmdNotFoundErr)
|
||||
}
|
||||
}
|
||||
for _, notificationID := range cmdList.Notifications {
|
||||
if !backyViper.IsSet(getNestedConfig("notifications", notificationID)) {
|
||||
logging.ExitWithMSG(fmt.Sprintf("%s in list %s not found in notifications", notificationID, cmdListName), 1, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(cmdNotFoundSliceErr) > 0 {
|
||||
@ -218,40 +214,35 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
cmdNotFoundErrorLog.Errs("commands not found", cmdNotFoundSliceErr).Send()
|
||||
}
|
||||
|
||||
if opts.useCron && (len(backyConfigFile.CmdConfigLists) == 0) {
|
||||
if opts.useCron && (len(opts.CmdConfigLists) == 0) {
|
||||
logging.ExitWithMSG("No cron fields detected in any command lists", 1, nil)
|
||||
}
|
||||
|
||||
for c := range commandsMap {
|
||||
for c := range opts.Cmds {
|
||||
if opts.executeCmds != nil && !contains(opts.executeCmds, c) {
|
||||
delete(backyConfigFile.Cmds, c)
|
||||
delete(opts.Cmds, c)
|
||||
}
|
||||
}
|
||||
|
||||
if len(opts.executeLists) > 0 {
|
||||
for l := range backyConfigFile.CmdConfigLists {
|
||||
for l := range opts.CmdConfigLists {
|
||||
if !contains(opts.executeLists, l) {
|
||||
delete(backyConfigFile.CmdConfigLists, l)
|
||||
delete(opts.CmdConfigLists, l)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var notificationsMap = make(map[string]interface{})
|
||||
if backyViper.IsSet("notifications") {
|
||||
notificationsMap = backyViper.GetStringMap("notifications")
|
||||
for id := range notificationsMap {
|
||||
notifConfig := backyViper.Sub(getNestedConfig("notifications", id))
|
||||
config := &NotificationsConfig{
|
||||
Config: notifConfig,
|
||||
Enabled: true,
|
||||
}
|
||||
backyConfigFile.Notifications[id] = config
|
||||
if backyKoanf.Exists("notifications") {
|
||||
|
||||
unmarshalErr = backyKoanf.UnmarshalWithConf("notifications", &opts.NotificationConf, koanf.UnmarshalConf{Tag: "yaml"})
|
||||
if unmarshalErr != nil {
|
||||
fmt.Printf("error unmarshalling notifications object: %v", unmarshalErr)
|
||||
}
|
||||
}
|
||||
|
||||
for _, cmd := range backyConfigFile.Cmds {
|
||||
for _, cmd := range opts.Cmds {
|
||||
if cmd.Host != nil {
|
||||
host, hostFound := backyConfigFile.Hosts[*cmd.Host]
|
||||
host, hostFound := opts.Hosts[*cmd.Host]
|
||||
if hostFound {
|
||||
cmd.RemoteHost = host
|
||||
cmd.RemoteHost.Host = host.Host
|
||||
@ -259,19 +250,18 @@ func ReadConfig(opts *ConfigOpts) *ConfigFile {
|
||||
cmd.RemoteHost.HostName = host.HostName
|
||||
}
|
||||
} else {
|
||||
backyConfigFile.Hosts[*cmd.Host] = &Host{Host: *cmd.Host}
|
||||
opts.Hosts[*cmd.Host] = &Host{Host: *cmd.Host}
|
||||
cmd.RemoteHost = &Host{Host: *cmd.Host}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
backyConfigFile.SetupNotify()
|
||||
opts.ConfigFile = backyConfigFile
|
||||
opts.SetupNotify()
|
||||
if err := opts.setupVault(); err != nil {
|
||||
log.Err(err).Send()
|
||||
}
|
||||
opts.ConfigFile = backyConfigFile
|
||||
return backyConfigFile
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
func getNestedConfig(nestedConfig, key string) string {
|
||||
@ -290,16 +280,16 @@ func getLoggingKeyFromConfig(key string) string {
|
||||
}
|
||||
|
||||
func getCmdListFromConfig(list string) string {
|
||||
return fmt.Sprintf("cmd-configs.%s", list)
|
||||
return fmt.Sprintf("cmd-lists.%s", list)
|
||||
}
|
||||
|
||||
func (opts *ConfigOpts) setupVault() error {
|
||||
if !opts.viper.GetBool("vault.enabled") {
|
||||
if !opts.koanf.Bool("vault.enabled") {
|
||||
return nil
|
||||
}
|
||||
config := vault.DefaultConfig()
|
||||
|
||||
config.Address = opts.viper.GetString("vault.address")
|
||||
config.Address = opts.koanf.String("vault.address")
|
||||
if strings.TrimSpace(config.Address) == "" {
|
||||
config.Address = os.Getenv("VAULT_ADDR")
|
||||
}
|
||||
@ -309,7 +299,7 @@ func (opts *ConfigOpts) setupVault() error {
|
||||
return err
|
||||
}
|
||||
|
||||
token := opts.viper.GetString("vault.token")
|
||||
token := opts.koanf.String("vault.token")
|
||||
if strings.TrimSpace(token) == "" {
|
||||
token = os.Getenv("VAULT_TOKEN")
|
||||
}
|
||||
@ -319,10 +309,9 @@ func (opts *ConfigOpts) setupVault() error {
|
||||
|
||||
client.SetToken(token)
|
||||
|
||||
cmdListCfg := opts.viper.Sub("viper.keys")
|
||||
unmarshalErr := cmdListCfg.Unmarshal(&opts.VaultKeys)
|
||||
unmarshalErr := opts.koanf.UnmarshalWithConf("vault.keys", &opts.VaultKeys, koanf.UnmarshalConf{Tag: "yaml"})
|
||||
if unmarshalErr != nil {
|
||||
panic(fmt.Errorf("error unmarshalling viper.keys into struct: %w", unmarshalErr))
|
||||
logging.ExitWithMSG(fmt.Sprintf("error unmarshalling vault.keys into struct: %v", unmarshalErr), 1, &opts.Logger)
|
||||
}
|
||||
|
||||
opts.vaultClient = client
|
||||
|
@ -5,31 +5,34 @@
|
||||
package backy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||
"github.com/go-co-op/gocron"
|
||||
)
|
||||
|
||||
func (opts *ConfigOpts) Cron() {
|
||||
s := gocron.NewScheduler(time.Local)
|
||||
s.TagsUnique()
|
||||
cmdLists := opts.ConfigFile.CmdConfigLists
|
||||
cmdLists := opts.CmdConfigLists
|
||||
for listName, config := range cmdLists {
|
||||
if config.Name == "" {
|
||||
config.Name = listName
|
||||
}
|
||||
|
||||
cron := strings.TrimSpace(config.Cron)
|
||||
if cron != "" {
|
||||
opts.ConfigFile.Logger.Info().Str("Scheduling cron list", config.Name).Str("Time", cron).Send()
|
||||
opts.Logger.Info().Str("Scheduling cron list", config.Name).Str("Time", cron).Send()
|
||||
_, err := s.CronWithSeconds(cron).Tag(config.Name).Do(func(cron string) {
|
||||
opts.ConfigFile.RunListConfig(cron, opts)
|
||||
opts.RunListConfig(cron)
|
||||
}, cron)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logging.ExitWithMSG(fmt.Sprintf("error: %v", err), 1, &opts.Logger)
|
||||
}
|
||||
}
|
||||
}
|
||||
opts.ConfigFile.Logger.Info().Msg("Starting cron mode...")
|
||||
opts.Logger.Info().Msg("Starting cron mode...")
|
||||
s.StartBlocking()
|
||||
}
|
||||
|
5
pkg/backy/list.go
Normal file
5
pkg/backy/list.go
Normal file
@ -0,0 +1,5 @@
|
||||
package backy
|
||||
|
||||
func (opts *ConfigOpts) ListConfiguration() {
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ const mongoConfigKey = "global.mongo"
|
||||
|
||||
func (opts *ConfigOpts) InitMongo() {
|
||||
|
||||
if !opts.viper.GetBool(getMongoConfigKey("enabled")) {
|
||||
if !opts.koanf.Bool(getMongoConfigKey("enabled")) {
|
||||
return
|
||||
}
|
||||
var (
|
||||
@ -27,38 +27,37 @@ func (opts *ConfigOpts) InitMongo() {
|
||||
)
|
||||
|
||||
// TODO: Get uri and creditials from config
|
||||
host := opts.viper.GetString(getMongoConfigKey("host"))
|
||||
port := opts.viper.GetInt32(getMongoConfigKey("port"))
|
||||
host := opts.koanf.String(getMongoConfigKey("host"))
|
||||
port := opts.koanf.Int64(getMongoConfigKey("port"))
|
||||
|
||||
client, err = mongo.NewClient(options.Client().ApplyURI(fmt.Sprintf("mongo://%s:%d", host, port)))
|
||||
if opts.viper.GetBool(getMongoConfigKey("prod")) {
|
||||
mongoEnvFileSet := opts.viper.IsSet(getMongoConfigKey("env"))
|
||||
ctx, ctxCancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer ctxCancel()
|
||||
client, err = mongo.Connect(ctx, options.Client().ApplyURI(fmt.Sprintf("mongo://%s:%d", host, port)))
|
||||
if opts.koanf.Bool(getMongoConfigKey("prod")) {
|
||||
mongoEnvFileSet := opts.koanf.Exists(getMongoConfigKey("env"))
|
||||
if mongoEnvFileSet {
|
||||
getMongoConfigFromEnv(opts)
|
||||
}
|
||||
auth := options.Credential{}
|
||||
auth.Password = opts.viper.GetString("global.mongo.password")
|
||||
auth.Username = opts.viper.GetString("global.mongo.username")
|
||||
client, err = mongo.NewClient(options.Client().SetAuth(auth).ApplyURI("mongodb://localhost:27017"))
|
||||
auth.Password = opts.koanf.String("global.mongo.password")
|
||||
auth.Username = opts.koanf.String("global.mongo.username")
|
||||
client, err = mongo.Connect(ctx, options.Client().SetAuth(auth).ApplyURI("mongodb://localhost:27017"))
|
||||
|
||||
}
|
||||
if err != nil {
|
||||
opts.ConfigFile.Logger.Fatal().Err(err).Send()
|
||||
opts.Logger.Fatal().Err(err).Send()
|
||||
}
|
||||
ctx, ctxCancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer ctxCancel()
|
||||
err = client.Connect(ctx)
|
||||
if err != nil {
|
||||
opts.ConfigFile.Logger.Fatal().Err(err).Send()
|
||||
opts.Logger.Fatal().Err(err).Send()
|
||||
}
|
||||
defer client.Disconnect(ctx)
|
||||
err = client.Ping(ctx, readpref.Primary())
|
||||
if err != nil {
|
||||
opts.ConfigFile.Logger.Fatal().Err(err).Send()
|
||||
opts.Logger.Fatal().Err(err).Send()
|
||||
}
|
||||
databases, err := client.ListDatabaseNames(ctx, bson.M{})
|
||||
if err != nil {
|
||||
opts.ConfigFile.Logger.Fatal().Err(err).Send()
|
||||
opts.Logger.Fatal().Err(err).Send()
|
||||
}
|
||||
fmt.Println(databases)
|
||||
backyDB := client.Database("backy")
|
||||
@ -69,7 +68,7 @@ func (opts *ConfigOpts) InitMongo() {
|
||||
}
|
||||
|
||||
func getMongoConfigFromEnv(opts *ConfigOpts) error {
|
||||
mongoEnvFile, err := os.Open(opts.viper.GetString("global.mongo.env"))
|
||||
mongoEnvFile, err := os.Open(opts.koanf.String("global.mongo.env"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -85,8 +84,8 @@ func getMongoConfigFromEnv(opts *ConfigOpts) error {
|
||||
if !mongoUserFound {
|
||||
return errors.New("MONGO_PASSWORD not set in " + mongoEnvFile.Name())
|
||||
}
|
||||
opts.viper.Set(mongoConfigKey+".password", mongoPW)
|
||||
opts.viper.Set(mongoConfigKey+".username", mongoUser)
|
||||
opts.koanf.Set(mongoConfigKey+".password", mongoPW)
|
||||
opts.koanf.Set(mongoConfigKey+".username", mongoUser)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -5,67 +5,76 @@ package backy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||
"github.com/nikoksr/notify"
|
||||
"github.com/nikoksr/notify/service/mail"
|
||||
"github.com/nikoksr/notify/service/matrix"
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
type matrixStruct struct {
|
||||
homeserver string
|
||||
roomid id.RoomID
|
||||
accessToken string
|
||||
userId id.UserID
|
||||
type MatrixStruct struct {
|
||||
Homeserver string `yaml:"homeserver"`
|
||||
Roomid id.RoomID `yaml:"room-id"`
|
||||
AccessToken string `yaml:"access-token"`
|
||||
UserId id.UserID `yaml:"user-id"`
|
||||
}
|
||||
|
||||
type mailConfig struct {
|
||||
senderaddress string
|
||||
host string
|
||||
to []string
|
||||
username string
|
||||
password string
|
||||
port string
|
||||
}
|
||||
|
||||
func SetupCommandsNotifiers(backyConfig ConfigFile, ids ...string) {
|
||||
|
||||
type MailConfig struct {
|
||||
Host string `yaml:"host"`
|
||||
Port string `yaml:"port"`
|
||||
Username string `yaml:"username"`
|
||||
SenderAddress string `yaml:"senderaddress"`
|
||||
To []string `yaml:"to"`
|
||||
Password string `yaml:"password"`
|
||||
}
|
||||
|
||||
// SetupNotify sets up notify instances for each command list.
|
||||
func (opts *ConfigOpts) SetupNotify() {
|
||||
|
||||
func (backyConfig *ConfigFile) SetupNotify() {
|
||||
// check if we have individual commands instead of lists to execute
|
||||
if len(opts.executeCmds) != 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, cmdConfig := range backyConfig.CmdConfigLists {
|
||||
for confName, cmdConfig := range opts.CmdConfigLists {
|
||||
var services []notify.Notifier
|
||||
for notifyID := range backyConfig.Notifications {
|
||||
if contains(cmdConfig.Notifications, notifyID) {
|
||||
for _, id := range cmdConfig.Notifications {
|
||||
if !strings.Contains(id, ".") {
|
||||
opts.Logger.Info().Str("id", id).Str("list", cmdConfig.Name).Msg("key does not contain a \".\" Make sure to follow the docs: https://backy.cybershell.xyz/config/notifications/")
|
||||
logging.ExitWithMSG(fmt.Sprintf("notification id %s in cmd list %s does not contain a \".\" \nMake sure to follow the docs: https://backy.cybershell.xyz/config/notifications/", id, cmdConfig.Name), 1, &opts.Logger)
|
||||
}
|
||||
|
||||
if backyConfig.Notifications[notifyID].Enabled {
|
||||
config := backyConfig.Notifications[notifyID].Config
|
||||
switch config.GetString("type") {
|
||||
case "matrix":
|
||||
mtrx := matrixStruct{
|
||||
userId: id.UserID(config.GetString("user-id")),
|
||||
roomid: id.RoomID(config.GetString("room-id")),
|
||||
accessToken: config.GetString("access-token"),
|
||||
homeserver: config.GetString("homeserver"),
|
||||
}
|
||||
mtrxClient, _ := setupMatrix(mtrx)
|
||||
services = append(services, mtrxClient)
|
||||
case "mail":
|
||||
mailCfg := mailConfig{
|
||||
senderaddress: config.GetString("senderaddress"),
|
||||
password: config.GetString("password"),
|
||||
username: config.GetString("username"),
|
||||
to: config.GetStringSlice("to"),
|
||||
host: config.GetString("host"),
|
||||
port: fmt.Sprint(config.GetUint16("port")),
|
||||
}
|
||||
mailClient := setupMail(mailCfg)
|
||||
services = append(services, mailClient)
|
||||
}
|
||||
confSplit := strings.Split(id, ".")
|
||||
confType := confSplit[0]
|
||||
confId := confSplit[1]
|
||||
switch confType {
|
||||
|
||||
case "mail":
|
||||
conf, ok := opts.NotificationConf.MailConfig[confId]
|
||||
if !ok {
|
||||
opts.Logger.Info().Err(fmt.Errorf("error: ID %s not found in mail object", confId)).Str("list", confName).Send()
|
||||
continue
|
||||
}
|
||||
mailConf := setupMail(conf)
|
||||
services = append(services, mailConf)
|
||||
case "matrix":
|
||||
conf, ok := opts.NotificationConf.MatrixConfig[confId]
|
||||
if !ok {
|
||||
opts.Logger.Info().Err(fmt.Errorf("error: ID %s not found in matrix object", confId)).Str("list", confName).Send()
|
||||
continue
|
||||
}
|
||||
mtrxConf, mtrxErr := setupMatrix(conf)
|
||||
if mtrxErr != nil {
|
||||
opts.Logger.Info().Str("list", confName).Err(fmt.Errorf("error: configuring matrix id %s failed during setup: %w", id, mtrxErr))
|
||||
continue
|
||||
}
|
||||
// append the services
|
||||
services = append(services, mtrxConf)
|
||||
// service is not recognized
|
||||
default:
|
||||
opts.Logger.Info().Err(fmt.Errorf("id %s not found", id)).Str("list", confName).Send()
|
||||
}
|
||||
}
|
||||
cmdConfig.NotifyConfig = notify.NewWithServices(services...)
|
||||
@ -74,19 +83,18 @@ func (backyConfig *ConfigFile) SetupNotify() {
|
||||
// logging.ExitWithMSG("This was a test of notifications", 0, nil)
|
||||
}
|
||||
|
||||
func setupMatrix(config matrixStruct) (*matrix.Matrix, error) {
|
||||
matrixClient, matrixErr := matrix.New(config.userId, config.roomid, config.homeserver, config.accessToken)
|
||||
func setupMatrix(config MatrixStruct) (*matrix.Matrix, error) {
|
||||
matrixClient, matrixErr := matrix.New(config.UserId, config.Roomid, config.Homeserver, config.AccessToken)
|
||||
if matrixErr != nil {
|
||||
panic(matrixErr)
|
||||
return nil, matrixErr
|
||||
}
|
||||
return matrixClient, nil
|
||||
|
||||
}
|
||||
|
||||
func setupMail(config mailConfig) *mail.Mail {
|
||||
mailClient := mail.New(config.senderaddress, config.host+":"+config.port)
|
||||
mailClient.AuthenticateSMTP("", config.username, config.password, config.host)
|
||||
mailClient.AddReceivers(config.to...)
|
||||
func setupMail(config MailConfig) *mail.Mail {
|
||||
mailClient := mail.New(config.SenderAddress, config.Host+":"+config.Port)
|
||||
mailClient.AuthenticateSMTP("", config.Username, config.Password, config.Host)
|
||||
mailClient.AddReceivers(config.To...)
|
||||
mailClient.BodyFormat(mail.PlainText)
|
||||
return mailClient
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ var TS = strings.TrimSpace
|
||||
// It returns an ssh.Client used to run commands against.
|
||||
// If configFile is empty, any required configuration is looked up in the default config files
|
||||
// If any value is not found, defaults are used
|
||||
func (remoteConfig *Host) ConnectToSSHHost(opts *ConfigOpts, config *ConfigFile) error {
|
||||
func (remoteConfig *Host) ConnectToSSHHost(opts *ConfigOpts) error {
|
||||
|
||||
// var sshClient *ssh.Client
|
||||
var connectErr error
|
||||
@ -47,6 +47,11 @@ func (remoteConfig *Host) ConnectToSSHHost(opts *ConfigOpts, config *ConfigFile)
|
||||
var configFile *os.File
|
||||
var sshConfigFileOpenErr error
|
||||
if !remoteConfig.useDefaultConfig {
|
||||
var err error
|
||||
remoteConfig.ConfigFilePath, err = resolveDir(remoteConfig.ConfigFilePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
configFile, sshConfigFileOpenErr = os.Open(remoteConfig.ConfigFilePath)
|
||||
if sshConfigFileOpenErr != nil {
|
||||
return sshConfigFileOpenErr
|
||||
@ -66,14 +71,14 @@ func (remoteConfig *Host) ConnectToSSHHost(opts *ConfigOpts, config *ConfigFile)
|
||||
return decodeErr
|
||||
}
|
||||
|
||||
err := remoteConfig.GetProxyJumpFromConfig(config.Hosts)
|
||||
err := remoteConfig.GetProxyJumpFromConfig(opts.Hosts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if remoteConfig.ProxyHost != nil {
|
||||
for _, proxyHost := range remoteConfig.ProxyHost {
|
||||
err := proxyHost.GetProxyJumpConfig(config.Hosts, opts)
|
||||
opts.ConfigFile.Logger.Info().Msgf("Proxy host: %s", proxyHost.Host)
|
||||
err := proxyHost.GetProxyJumpConfig(opts.Hosts, opts)
|
||||
opts.Logger.Info().Msgf("Proxy host: %s", proxyHost.Host)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -101,24 +106,24 @@ func (remoteConfig *Host) ConnectToSSHHost(opts *ConfigOpts, config *ConfigFile)
|
||||
return errors.Wrap(err, "could not create hostkeycallback function")
|
||||
}
|
||||
remoteConfig.ClientConfig.HostKeyCallback = hostKeyCallback
|
||||
opts.ConfigFile.Logger.Info().Str("user", remoteConfig.ClientConfig.User).Send()
|
||||
opts.Logger.Info().Str("user", remoteConfig.ClientConfig.User).Send()
|
||||
|
||||
remoteConfig.SshClient, connectErr = remoteConfig.ConnectThroughBastion(opts.ConfigFile.Logger)
|
||||
remoteConfig.SshClient, connectErr = remoteConfig.ConnectThroughBastion(opts.Logger)
|
||||
if connectErr != nil {
|
||||
return connectErr
|
||||
}
|
||||
if remoteConfig.SshClient != nil {
|
||||
config.Hosts[remoteConfig.Host] = remoteConfig
|
||||
opts.Hosts[remoteConfig.Host] = remoteConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
opts.ConfigFile.Logger.Info().Msgf("Connecting to host %s", remoteConfig.HostName)
|
||||
opts.Logger.Info().Msgf("Connecting to host %s", remoteConfig.HostName)
|
||||
remoteConfig.SshClient, connectErr = ssh.Dial("tcp", remoteConfig.HostName, remoteConfig.ClientConfig)
|
||||
if connectErr != nil {
|
||||
return connectErr
|
||||
}
|
||||
|
||||
config.Hosts[remoteConfig.Host] = remoteConfig
|
||||
opts.Hosts[remoteConfig.Host] = remoteConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -148,7 +153,7 @@ func (remoteHost *Host) GetAuthMethods(opts *ConfigOpts) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
remoteHost.PrivateKeyPassword, err = GetPrivateKeyPassword(remoteHost.PrivateKeyPassword, opts, opts.ConfigFile.Logger)
|
||||
remoteHost.PrivateKeyPassword, err = GetPrivateKeyPassword(remoteHost.PrivateKeyPassword, opts, opts.Logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -167,7 +172,7 @@ func (remoteHost *Host) GetAuthMethods(opts *ConfigOpts) error {
|
||||
}
|
||||
}
|
||||
if remoteHost.Password == "" {
|
||||
remoteHost.Password, err = GetPassword(remoteHost.Password, opts, opts.ConfigFile.Logger)
|
||||
remoteHost.Password, err = GetPassword(remoteHost.Password, opts, opts.Logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -297,7 +302,7 @@ func GetPrivateKeyPassword(key string, opts *ConfigOpts, log zerolog.Logger) (st
|
||||
} else {
|
||||
prKeyPassword = key
|
||||
}
|
||||
prKeyPassword = GetVaultKey(prKeyPassword, opts, opts.ConfigFile.Logger)
|
||||
prKeyPassword = GetVaultKey(prKeyPassword, opts, opts.Logger)
|
||||
return prKeyPassword, nil
|
||||
}
|
||||
|
||||
@ -328,7 +333,7 @@ func GetPassword(pass string, opts *ConfigOpts, log zerolog.Logger) (string, err
|
||||
} else {
|
||||
password = pass
|
||||
}
|
||||
password = GetVaultKey(password, opts, opts.ConfigFile.Logger)
|
||||
password = GetVaultKey(password, opts, opts.Logger)
|
||||
|
||||
return password, nil
|
||||
}
|
||||
@ -412,7 +417,7 @@ func (remoteConfig *Host) GetProxyJumpConfig(hosts map[string]*Host, opts *Confi
|
||||
// TODO: Add value/option to config for host key and add bool to check for host key
|
||||
hostKeyCallback, err := knownhosts.New(khPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not create hostkeycallback function")
|
||||
return fmt.Errorf("could not create hostkeycallback function: %v", err)
|
||||
}
|
||||
remoteConfig.ClientConfig.HostKeyCallback = hostKeyCallback
|
||||
hosts[remoteConfig.Host] = remoteConfig
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
|
||||
vaultapi "github.com/hashicorp/vault/api"
|
||||
"github.com/kevinburke/ssh_config"
|
||||
"github.com/knadh/koanf/v2"
|
||||
"github.com/nikoksr/notify"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/spf13/viper"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"golang.org/x/crypto/ssh"
|
||||
@ -37,7 +37,7 @@ type (
|
||||
// Host defines a host to which to connect.
|
||||
// If not provided, the values will be looked up in the default ssh config files
|
||||
Host struct {
|
||||
ConfigFilePath string `yaml:"configfilepath,omitempty"`
|
||||
ConfigFilePath string `yaml:"config,omitempty"`
|
||||
Host string `yaml:"host,omitempty"`
|
||||
HostName string `yaml:"hostname,omitempty"`
|
||||
KnownHostsFile string `yaml:"knownhostsfile,omitempty"`
|
||||
@ -100,6 +100,8 @@ type (
|
||||
// Output determines if output is requested.
|
||||
// Only works if command is in a list.
|
||||
GetOutput bool `yaml:"getOutput,omitempty"`
|
||||
|
||||
ScriptEnvFile string `yaml:"scriptEnvFile"`
|
||||
}
|
||||
|
||||
BackyOptionFunc func(*ConfigOpts)
|
||||
@ -111,35 +113,26 @@ type (
|
||||
Notifications []string `yaml:"notifications,omitempty"`
|
||||
GetOutput bool `yaml:"getOutput,omitempty"`
|
||||
NotifyConfig *notify.Notify
|
||||
// NotificationsConfig map[string]*NotificationsConfig
|
||||
// NotifyConfig map[string]*notify.Notify
|
||||
}
|
||||
|
||||
ConfigFile struct {
|
||||
|
||||
ConfigOpts struct {
|
||||
// Cmds holds the commands for a list.
|
||||
// Key is the name of the command,
|
||||
Cmds map[string]*Command `yaml:"commands"`
|
||||
|
||||
// CmdConfigLists holds the lists of commands to be run in order.
|
||||
// Key is the command list name.
|
||||
CmdConfigLists map[string]*CmdList `yaml:"cmd-configs"`
|
||||
CmdConfigLists map[string]*CmdList `yaml:"cmd-lists"`
|
||||
|
||||
// Hosts holds the Host config.
|
||||
// key is the host.
|
||||
Hosts map[string]*Host `yaml:"hosts"`
|
||||
|
||||
// Notifications holds the config for different notifications.
|
||||
Notifications map[string]*NotificationsConfig
|
||||
|
||||
Logger zerolog.Logger
|
||||
}
|
||||
|
||||
ConfigOpts struct {
|
||||
// Global log level
|
||||
BackyLogLvl *string
|
||||
// Holds config file
|
||||
ConfigFile *ConfigFile
|
||||
|
||||
// Holds config file
|
||||
ConfigFilePath string
|
||||
|
||||
@ -158,9 +151,13 @@ type (
|
||||
|
||||
vaultClient *vaultapi.Client
|
||||
|
||||
List ListConfig
|
||||
|
||||
VaultKeys []*VaultKey `yaml:"keys"`
|
||||
|
||||
viper *viper.Viper
|
||||
koanf *koanf.Koanf
|
||||
|
||||
NotificationConf *Notifications `yaml:"notifications"`
|
||||
}
|
||||
|
||||
outStruct struct {
|
||||
@ -183,9 +180,9 @@ type (
|
||||
Keys []*VaultKey `yaml:"keys"`
|
||||
}
|
||||
|
||||
NotificationsConfig struct {
|
||||
Config *viper.Viper
|
||||
Enabled bool
|
||||
Notifications struct {
|
||||
MailConfig map[string]MailConfig `yaml:"mail,omitempty"`
|
||||
MatrixConfig map[string]MatrixStruct `yaml:"matrix,omitempty"`
|
||||
}
|
||||
|
||||
CmdOutput struct {
|
||||
@ -202,4 +199,10 @@ type (
|
||||
success *template.Template
|
||||
err *template.Template
|
||||
}
|
||||
|
||||
ListConfig struct {
|
||||
Lists []string
|
||||
Commands []string
|
||||
Hosts []string
|
||||
}
|
||||
)
|
||||
|
@ -15,12 +15,65 @@ import (
|
||||
|
||||
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/knadh/koanf/v2"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"mvdan.cc/sh/v3/shell"
|
||||
)
|
||||
|
||||
func (c *ConfigOpts) LogLvl(level string) BackyOptionFunc {
|
||||
|
||||
return func(bco *ConfigOpts) {
|
||||
c.BackyLogLvl = &level
|
||||
}
|
||||
}
|
||||
|
||||
// AddCommands adds commands to ConfigOpts
|
||||
func AddCommands(commands []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.executeCmds = append(bco.executeCmds, commands...)
|
||||
}
|
||||
}
|
||||
|
||||
// AddCommandLists adds lists to ConfigOpts
|
||||
func AddCommandLists(lists []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.executeLists = append(bco.executeLists, lists...)
|
||||
}
|
||||
}
|
||||
|
||||
// AddPrintLists adds lists to print out
|
||||
func SetListsToSearch(lists []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.List.Lists = append(bco.List.Lists, lists...)
|
||||
}
|
||||
}
|
||||
|
||||
// AddPrintLists adds lists to print out
|
||||
func SetCmdsToSearch(cmds []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.List.Commands = append(bco.List.Commands, cmds...)
|
||||
}
|
||||
}
|
||||
|
||||
// UseCron enables the execution of command lists at specified times
|
||||
func UseCron() BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.useCron = true
|
||||
}
|
||||
}
|
||||
|
||||
func NewOpts(configFilePath string, opts ...BackyOptionFunc) *ConfigOpts {
|
||||
b := &ConfigOpts{}
|
||||
b.ConfigFilePath = configFilePath
|
||||
for _, opt := range opts {
|
||||
if opt != nil {
|
||||
opt(b)
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func injectEnvIntoSSH(envVarsToInject environmentVars, process *ssh.Session, opts *ConfigOpts, log zerolog.Logger) {
|
||||
if envVarsToInject.file != "" {
|
||||
envPath, envPathErr := resolveDir(envVarsToInject.file)
|
||||
@ -94,12 +147,12 @@ func contains(s []string, e string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func CheckConfigValues(config *viper.Viper) {
|
||||
func CheckConfigValues(config *koanf.Koanf, file string) {
|
||||
|
||||
for _, key := range requiredKeys {
|
||||
isKeySet := config.IsSet(key)
|
||||
isKeySet := config.Exists(key)
|
||||
if !isKeySet {
|
||||
logging.ExitWithMSG(Sprintf("Config key %s is not defined in %s. Please make sure this value is set and has the appropriate keys set.", key, config.ConfigFileUsed()), 1, nil)
|
||||
logging.ExitWithMSG(Sprintf("Config key %s is not defined in %s. Please make sure this value is set and has the appropriate keys set.", key, file), 1, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,64 +169,6 @@ func testFile(c string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ConfigOpts) LogLvl(level string) BackyOptionFunc {
|
||||
|
||||
return func(bco *ConfigOpts) {
|
||||
c.BackyLogLvl = &level
|
||||
}
|
||||
}
|
||||
|
||||
// AddCommands adds commands to ConfigOpts
|
||||
func AddCommands(commands []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.executeCmds = append(bco.executeCmds, commands...)
|
||||
}
|
||||
}
|
||||
|
||||
// AddCommandLists adds lists to ConfigOpts
|
||||
func AddCommandLists(lists []string) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.executeLists = append(bco.executeLists, lists...)
|
||||
}
|
||||
}
|
||||
|
||||
// UseCron enables the execution of command lists at specified times
|
||||
func UseCron() BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
bco.useCron = true
|
||||
}
|
||||
}
|
||||
|
||||
// UseCron enables the execution of command lists at specified times
|
||||
func (c *ConfigOpts) AddViper(v *viper.Viper) BackyOptionFunc {
|
||||
return func(bco *ConfigOpts) {
|
||||
c.viper = v
|
||||
}
|
||||
}
|
||||
|
||||
func NewOpts(configFilePath string, opts ...BackyOptionFunc) *ConfigOpts {
|
||||
b := &ConfigOpts{}
|
||||
b.ConfigFilePath = configFilePath
|
||||
for _, opt := range opts {
|
||||
if opt != nil {
|
||||
opt(b)
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
/*
|
||||
NewConfig initializes new config that holds information from the config file
|
||||
*/
|
||||
func NewConfig() *ConfigFile {
|
||||
return &ConfigFile{
|
||||
Cmds: make(map[string]*Command),
|
||||
CmdConfigLists: make(map[string]*CmdList),
|
||||
Hosts: make(map[string]*Host),
|
||||
Notifications: make(map[string]*NotificationsConfig),
|
||||
}
|
||||
}
|
||||
|
||||
func IsTerminalActive() bool {
|
||||
return os.Getenv("BACKY_TERM") == "enabled"
|
||||
}
|
||||
@ -203,7 +198,7 @@ func resolveDir(path string) (string, error) {
|
||||
}
|
||||
|
||||
func (opts *ConfigOpts) loadEnv() {
|
||||
envFileInConfigDir := fmt.Sprintf("%s/.env", path.Dir(opts.viper.ConfigFileUsed()))
|
||||
envFileInConfigDir := fmt.Sprintf("%s/.env", path.Dir(opts.ConfigFilePath))
|
||||
var backyEnv map[string]string
|
||||
backyEnv, envFileErr := godotenv.Read(envFileInConfigDir)
|
||||
if envFileErr != nil {
|
||||
|
@ -49,7 +49,7 @@ func SetLoggingWriters(logFile string) (writers zerolog.LevelWriter) {
|
||||
}
|
||||
|
||||
fileLogger := &lumberjack.Logger{
|
||||
MaxSize: 500, // megabytes
|
||||
MaxSize: 50, // megabytes
|
||||
MaxBackups: 3,
|
||||
MaxAge: 28, //days
|
||||
Compress: true, // disabled by default
|
||||
|
Loading…
Reference in New Issue
Block a user