feat: inject build string in ssh binary, expose default ssh port
Some checks failed
release / docker (push) Has been cancelled

This commit is contained in:
Mohamed Sohail 2025-01-06 11:09:51 +03:00
parent 4836162f40
commit a312ea5b84
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
2 changed files with 15 additions and 12 deletions

View File

@ -39,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"
@ -18,10 +18,12 @@ import (
) )
var ( var (
wg sync.WaitGroup wg sync.WaitGroup
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 {
@ -90,14 +92,14 @@ func main() {
signal.Notify(cterm, os.Interrupt, syscall.SIGTERM) signal.Notify(cterm, os.Interrupt, syscall.SIGTERM)
runner := &ssh.SshRunner{ runner := &ssh.SshRunner{
Cfg: cfg, Cfg: cfg,
Debug: engineDebug, Debug: engineDebug,
FlagFile: pfp, FlagFile: pfp,
DbDir: dbDir, DbDir: dbDir,
ResourceDir: resourceDir, ResourceDir: resourceDir,
SrvKeyFile: sshKeyFile, SrvKeyFile: sshKeyFile,
Host: host, Host: host,
Port: port, Port: port,
} }
go func() { go func() {
select { select {
@ -109,7 +111,7 @@ func main() {
if err != nil { if err != nil {
logg.ErrorCtxf(ctx, "runner stop error", "err", err) logg.ErrorCtxf(ctx, "runner stop error", "err", err)
} }
}() }()
runner.Run(ctx, authKeyStore) runner.Run(ctx, authKeyStore)
} }