Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DB_DEBUG env var work #343

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func rootCmd(execs execs) (*cobra.Command, error) {
bindFlags(cmd, v)
var logger = log.New()
logLevel := v.GetInt("verbose")
debugSet := v.IsSet("debug")
if !v.IsSet("verbose") && (v.GetBool("debug") || (debugSet && v.GetString("debug") == "true")) {
logLevel = 1
}
switch logLevel {
case 0:
logger.SetLevel(log.InfoLevel)
Expand Down Expand Up @@ -179,6 +183,7 @@ func rootCmd(execs execs) (*cobra.Command, error) {

// debug via CLI or env var or default
pflags.IntP("verbose", "v", 0, "set log level, 1 is debug, 2 is trace")
pflags.Bool("debug", false, "set log level to debug, equivalent of --verbose=1; if both set, --version always overrides")

// aws options
pflags.String("aws-endpoint-url", "", "Specify an alternative endpoint for s3 interoperable systems e.g. Digitalocean; ignored if not using s3.")
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The following are the environment variables, CLI flags and configuration file op
| what time to do the first dump or prune | BP | `dump --begin` | `DB_DUMP_BEGIN` | `dump.schedule.begin` | `0`, i.e. immediately |
| cron schedule for dumps or prunes | BP | `dump --cron` | `DB_DUMP_CRON` | `dump.schedule.cron` | |
| run the backup or prune a single time and exit | BP | `dump --once` | `DB_DUMP_ONCE` | `dump.schedule.once` | `false` |
| enable debug logging | BRP | `debug` | `DEBUG` | `logging` | `false` |
| enable debug logging | BRP | `debug` | `DB_DEBUG` | `logging` | `false` |
| where to put the dump file; see [backup](./backup.md) | BP | `dump --target` | `DB_DUMP_TARGET` | `dump.targets` | |
| where the restore file exists; see [restore](./restore.md) | R | `restore --target` | `DB_RESTORE_TARGET` | `restore.target` | |
| replace any `:` in the dump filename with `-` | BP | `dump --safechars` | `DB_DUMP_SAFECHARS` | `database.safechars` | `false` |
Expand Down
Loading