Skip to content

Commit

Permalink
Fixes and config example
Browse files Browse the repository at this point in the history
  • Loading branch information
koo04 committed Sep 27, 2024
1 parent 217a83d commit cea380d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ COPY . /src
RUN go clean -modcache
RUN go build

FROM alpine:latest
FROM ubuntu:latest
COPY --from=builder /src/ccdb /usr/local/bin/ccdb
EXPOSE 6379
COPY --from=builder /src/config.example.toml /etc/ccdb/config.toml
EXPOSE 6969
ENTRYPOINT ["/usr/local/bin/ccdb"]
3 changes: 3 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
log_level="debug"
badger_file="cc.db"
port=":6969"
4 changes: 2 additions & 2 deletions keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
)

func keys(db *badger.DB, conn redcon.Conn, cmd redcon.Command) (any, error) {
log.Debug().Str("pattern", string(cmd.Args[1])).Msg("keys")

if len(cmd.Args) != 2 {
return nil, errors.New("ERR wrong number of arguments for 'KEYS' command")
}

log.Debug().Str("pattern", string(cmd.Args[1])).Msg("keys")

keys := []string{}
if err := db.View(func(txn *badger.Txn) error {
opts := badger.DefaultIteratorOptions
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {
SETTINGS.AddConfigPath(".")
SETTINGS.AddConfigPath("./config")
SETTINGS.AddConfigPath("/etc/ccdb")
SETTINGS.SetConfigName("ccdb")
SETTINGS.SetConfigName("config")

// Find and read the config file
if err := SETTINGS.ReadInConfig(); err != nil {
Expand Down

0 comments on commit cea380d

Please sign in to comment.