Skip to content

Commit

Permalink
update main
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Jul 17, 2024
1 parent cc3d4a1 commit 86e0129
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions internal/tasks/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ package tasks
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
app_api "github.com/nextmn/srv6/internal/app/api"
"github.com/nextmn/srv6/internal/database"
"log"
"os"
"time"

_ "github.com/lib/pq"
app_api "github.com/nextmn/srv6/internal/app/api"
"github.com/nextmn/srv6/internal/database"
)

// DBTask initializes the database
Expand Down Expand Up @@ -94,6 +95,7 @@ func (db *DBTask) RunInit() error {
maxAttempts := 16
ok = false
for errcnt := 0; errcnt < maxAttempts; errcnt++ {
//FIXME: use select and time.After
if err := postgres.Ping(); err != nil {
// Exponential backoff
time.Sleep(100 * (1 << errcnt) * time.Millisecond)
Expand Down
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package main

import (
"fmt"
"log"
"os"
"os/signal"
Expand Down Expand Up @@ -55,7 +54,7 @@ func main() {
Action: func(c *cli.Context) error {
conf, err := srv6_config.ParseConf(config_file)
if err != nil {
fmt.Println("Error loading config, exiting…:", err)
log.Println("Error loading config, exiting…:", err)
os.Exit(1)
}

Expand All @@ -65,7 +64,7 @@ func main() {
}(ch, setup)
setup.AddTasks()
if err := setup.Run(); err != nil {
fmt.Println("Error while running, exiting…:", err)
log.Println("Error while running, exiting…:", err)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to password_file
flows to a logging call.
setup.Exit()
os.Exit(2)
}
Expand Down

0 comments on commit 86e0129

Please sign in to comment.