Merge remote-tracking branch 'urdt' into lash/purify-more

This commit is contained in:
lash 2025-01-06 08:46:01 +00:00
commit cd575c2edb
5 changed files with 30 additions and 15 deletions

View File

@ -1,5 +1,6 @@
/** /**
!/cmd/africastalking !/cmd/africastalking
!/cmd/ssh
!/common !/common
!/config !/config
!/initializers !/initializers

View File

@ -19,6 +19,7 @@ WORKDIR /build
RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM"
RUN go mod download RUN go mod download
RUN go build -tags logtrace -o ussd-africastalking -ldflags="-X main.build=${BUILD} -s -w" cmd/africastalking/main.go RUN go build -tags logtrace -o ussd-africastalking -ldflags="-X main.build=${BUILD} -s -w" cmd/africastalking/main.go
RUN go build -tags logtrace -o ussd-ssh -ldflags="-X main.build=${BUILD} -s -w" cmd/ssh/main.go
FROM debian:bookworm-slim FROM debian:bookworm-slim
@ -30,6 +31,7 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /service WORKDIR /service
COPY --from=build /build/ussd-africastalking . COPY --from=build /build/ussd-africastalking .
COPY --from=build /build/ussd-ssh .
COPY --from=build /build/LICENSE . COPY --from=build /build/LICENSE .
COPY --from=build /build/README.md . COPY --from=build /build/README.md .
COPY --from=build /build/services ./services COPY --from=build /build/services ./services
@ -37,5 +39,6 @@ COPY --from=build /build/.env.example .
RUN mv .env.example .env RUN mv .env.example .env
EXPOSE 7123 EXPOSE 7123
EXPOSE 7122
CMD ["./ussd-africastalking"] CMD ["./ussd-africastalking"]

View File

@ -4,9 +4,9 @@ import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
"path"
"os" "os"
"os/signal" "os/signal"
"path"
"sync" "sync"
"syscall" "syscall"
@ -22,6 +22,8 @@ var (
keyStore db.Db keyStore db.Db
logg = logging.NewVanilla() logg = logging.NewVanilla()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
build = "dev"
) )
func main() { func main() {
@ -76,7 +78,7 @@ func main() {
fmt.Fprintf(os.Stderr, "keystore file open error: %v", err) fmt.Fprintf(os.Stderr, "keystore file open error: %v", err)
os.Exit(1) os.Exit(1)
} }
defer func () { defer func() {
logg.TraceCtxf(ctx, "shutdown auth key store reached") logg.TraceCtxf(ctx, "shutdown auth key store reached")
err = authKeyStore.Close() err = authKeyStore.Close()
if err != nil { if err != nil {

View File

@ -25,6 +25,15 @@ func init() {
} }
func formatItem(k []byte, v []byte) (string, error) {
o, err := debug.FromKey(k)
if err != nil {
return "", err
}
s := fmt.Sprintf("%vValue: %v\n\n", o, string(v))
return s, nil
}
func main() { func main() {
config.LoadConfig() config.LoadConfig()
@ -75,12 +84,12 @@ func main() {
if k == nil { if k == nil {
break break
} }
o, err := debug.FromKey(k) r, err := formatItem(k, v)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "format db item error: %v", err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("%vValue: %v\n\n", o, string(v)) fmt.Printf(r)
} }
err = store.Close() err = store.Close()