mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-01-02 23:14:51 +08:00
Rename to print-config
This commit is contained in:
parent
a826828d76
commit
17f1e33b8a
8 changed files with 12 additions and 12 deletions
|
|
@ -16,8 +16,8 @@ func main() {
|
|||
|
||||
if len(additionalArgs) > 0 {
|
||||
switch additionalArgs[0] {
|
||||
case "show-config":
|
||||
c.must(runShowConfig())
|
||||
case "print-config":
|
||||
c.must(runPrintConfig())
|
||||
return
|
||||
default:
|
||||
panic("unknown command: " + additionalArgs[0])
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/offen/docker-volume-backup/internal/errwrap"
|
||||
)
|
||||
|
||||
func runShowConfig() error {
|
||||
func runPrintConfig() error {
|
||||
configurations, err := sourceConfiguration(configStrategyConfd)
|
||||
if err != nil {
|
||||
fmt.Printf("error sourcing configuration: %v\n", err) // print error to stdout for debugging
|
||||
|
|
@ -5,12 +5,12 @@ parent: How Tos
|
|||
nav_order: 8
|
||||
---
|
||||
|
||||
# Show loaded configuration
|
||||
# Print loaded configuration
|
||||
|
||||
You can print the configuration that `docker-volume-backup` has picked up without running a backup:
|
||||
|
||||
```console
|
||||
docker exec <container_ref> backup show-config
|
||||
docker exec <container_ref> backup print-config
|
||||
```
|
||||
|
||||
If configuration sourcing fails, the error is printed to stdout to aid debugging.
|
||||
|
|
@ -18,7 +18,7 @@ If configuration sourcing fails, the error is printed to stdout to aid debugging
|
|||
If you want to test a one-off value, pass it directly:
|
||||
|
||||
```console
|
||||
docker exec -e BACKUP_SOURCES=/backup -e NOTIFICATION_URLS=stdout:// <container_ref> backup show-config
|
||||
docker exec -e BACKUP_SOURCES=/backup -e NOTIFICATION_URLS=stdout:// <container_ref> backup print-config
|
||||
```
|
||||
|
||||
Note: output includes secrets exactly as loaded.
|
||||
|
|
@ -19,7 +19,7 @@ You can work around this by either updating `docker-compose` or unquoting your c
|
|||
|
||||
You can populate below template according to your requirements and use it as your `env_file`.
|
||||
The values for each key currently match its default.
|
||||
If you need to confirm what the container actually loaded, see [Show loaded configuration](../how-tos/show-configuration.md).
|
||||
If you need to confirm what the container actually loaded, see [Show loaded configuration](../how-tos/print-configuration.md).
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ cd "$(dirname "$0")"
|
|||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
info "show-config with environment variables"
|
||||
info "print-config with environment variables"
|
||||
docker compose up -d --quiet-pull
|
||||
logs=$(docker compose exec -T backup backup show-config)
|
||||
logs=$(docker compose exec -T backup backup print-config)
|
||||
|
||||
echo "$logs"
|
||||
|
||||
|
|
@ -39,17 +39,17 @@ pass "AWS_S3_BUCKET_NAME present."
|
|||
|
||||
docker compose down
|
||||
|
||||
info "show-config with conf.d and _FILE"
|
||||
info "print-config with conf.d and _FILE"
|
||||
export CONF_DIR=$(pwd)/conf.d
|
||||
export SECRET_FILE=$(mktemp)
|
||||
printf "stdout://\n" > "$SECRET_FILE"
|
||||
|
||||
docker compose -f docker-compose.confd.yml up -d --quiet-pull
|
||||
logs=$(docker compose -f docker-compose.confd.yml exec -T backup backup show-config)
|
||||
logs=$(docker compose -f docker-compose.confd.yml exec -T backup backup print-config)
|
||||
|
||||
echo "$logs"
|
||||
|
||||
if ! echo "$logs" | grep -q "source=01show-config.env"; then
|
||||
if ! echo "$logs" | grep -q "source=01print-config.env"; then
|
||||
fail "Missing conf.d source line."
|
||||
fi
|
||||
pass "conf.d source line present."
|
||||
Loading…
Add table
Reference in a new issue