more doc, fix format str

This commit is contained in:
2024-12-22 13:26:29 +01:00
committed by T.v.Dein
parent 249c3f1cfb
commit fe3951f3c2
4 changed files with 24 additions and 5 deletions

View File

@@ -66,11 +66,11 @@ clean:
rm -rf $(tool) releases coverage.out
test:
go test -v ./...
ANYDB_PASSWORD=test go test -v ./...
singletest:
@echo "Call like this: ''make singletest TEST=TestPrepareColumns MOD=lib"
go test -run $(TEST) github.com/tlinden/anydb/$(MOD)
ANYDB_PASSWORD=test go test -run $(TEST) github.com/tlinden/anydb/$(MOD)
cover-report:
go test ./... -cover -coverprofile=coverage.out

View File

@@ -145,6 +145,10 @@ curl localhost:8787/anydb/v1/foo
# list keys
curl localhost:8787/anydb/v1/
# sometimes you need to know some details about the current database
# add -d for more details
anydb info
# it comes with a manpage builtin
anydb man
```

14
example.toml Normal file
View File

@@ -0,0 +1,14 @@
# defaults
dbfile = "~/.config/anydb/default.db"
dbbucket = "data"
noheaders = false
nohumanize = false
encrypt = false
listen = "localhost:8787"
# different setups for different buckets
[buckets.data]
encrypt = true
[buckets.test]
encrypt = false

View File

@@ -104,10 +104,11 @@ func Info(writer io.Writer, conf *cfg.Config, info *app.DbInfo) error {
if conf.NoHumanize {
fmt.Fprintf(
writer,
"%19s: %s\n%19s: %d\n%19s: %d\n",
"%19s: %s\n%19s: %d\n%19s: %d\n%19s: %t\n",
"Bucket", bucket.Name,
"Size", bucket.Size,
"Keys", bucket.Keys)
"Keys", bucket.Keys,
"Encrypted", conf.Encrypt)
} else {
fmt.Fprintf(
writer,
@@ -120,7 +121,7 @@ func Info(writer io.Writer, conf *cfg.Config, info *app.DbInfo) error {
if conf.Debug {
val := reflect.ValueOf(&bucket.Stats).Elem()
for i := 0; i < val.NumField(); i++ {
fmt.Fprintf(writer, "%19s: %d\n", val.Type().Field(i).Name, val.Field(i))
fmt.Fprintf(writer, "%19s: %v\n", val.Type().Field(i).Name, val.Field(i))
}
}