File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ package main
22
33import (
44 "context"
5- "fmt"
65 "os"
76 "os/signal"
7+ "path"
8+ "strconv"
89 "syscall"
910
1011 "github.com/Portshift/go-utils/healthz"
1112 logutils "github.com/Portshift/go-utils/log"
13+ "github.com/anchore/grype/grype/vulnerability"
1214 log "github.com/sirupsen/logrus"
1315 "github.com/spf13/viper"
1416 "github.com/urfave/cli"
@@ -24,7 +26,7 @@ func run(c *cli.Context) {
2426 conf := config .LoadConfig ()
2527
2628 // remove database directory if it exists to avoid using a corrupt database
27- dbDir := fmt . Sprintf ( "%s/%s" , conf .DbRootDir , conf . DbDirName )
29+ dbDir := path . Join ( conf .DbRootDir , strconv . Itoa ( vulnerability . SchemaVersion ) )
2830 if _ , err := os .Stat (dbDir ); ! os .IsNotExist (err ) {
2931 if err = os .RemoveAll (dbDir ); err != nil {
3032 log .Fatalf ("Unable to delete existing DB directory: %v" , err )
@@ -73,7 +75,6 @@ func main() {
7375 viper .SetDefault (config .HealthCheckAddress , ":8080" )
7476 viper .SetDefault (config .DbRootDir , "/app/" )
7577 viper .SetDefault (config .DbUpdateURL , "https://toolbox-data.anchore.io/grype/databases/listing.json" )
76- viper .SetDefault (config .DbDirName , "3" )
7778 viper .AutomaticEnv ()
7879
7980 app := cli .NewApp ()
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ const (
1010 HealthCheckAddress = "HEALTH_CHECK_ADDRESS"
1111 DbRootDir = "DB_ROOT_DIR"
1212 DbUpdateURL = "DB_UPDATE_URL"
13- DbDirName = "DB_DIR_NAME"
1413)
1514
1615type Config struct {
@@ -19,7 +18,6 @@ type Config struct {
1918 HealthCheckAddress string
2019 DbRootDir string
2120 DbUpdateURL string
22- DbDirName string
2321}
2422
2523func LoadConfig () * Config {
@@ -30,7 +28,6 @@ func LoadConfig() *Config {
3028 config .HealthCheckAddress = viper .GetString (HealthCheckAddress )
3129 config .DbRootDir = viper .GetString (DbRootDir )
3230 config .DbUpdateURL = viper .GetString (DbUpdateURL )
33- config .DbDirName = viper .GetString (DbDirName )
3431
3532 return config
3633}
You can’t perform that action at this time.
0 commit comments