Skip to content

Commit

Permalink
fix linter, run go mod tidy
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <bcallaway@google.com>
  • Loading branch information
bobcallaway committed Sep 27, 2022
1 parent 9075c47 commit 994a989
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/rekor-server/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Memory and file-based signers should only be used for testing.`)
rootCmd.PersistentFlags().Uint16("port", 3000, "Port to bind to")

rootCmd.PersistentFlags().Bool("enable_retrieve_api", true, "enables Redis-based index API endpoint")
rootCmd.PersistentFlags().MarkDeprecated("enable_retrieve_api", "this flag is deprecated in favor of enabled_api_endpoints (searchIndex)")
_ = rootCmd.PersistentFlags().MarkDeprecated("enable_retrieve_api", "this flag is deprecated in favor of enabled_api_endpoints (searchIndex)")
rootCmd.PersistentFlags().String("redis_server.address", "127.0.0.1", "Redis server address")
rootCmd.PersistentFlags().Uint16("redis_server.port", 6379, "Redis server port")

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ require (
github.com/tent/canonical-json-go v0.0.0-20130607151641-96e4ba3a7613
github.com/theupdateframework/go-tuf v0.5.1-0.20220920170306-f237d7ca5b42
github.com/transparency-dev/merkle v0.0.1
github.com/urfave/negroni v1.0.0
github.com/veraison/go-cose v1.0.0-rc.1
github.com/zalando/go-keyring v0.1.1 // indirect
go.uber.org/goleak v1.2.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,6 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY
github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/veraison/go-cose v1.0.0-rc.1 h1:4qA7dbFJGvt7gcqv5MCIyCQvN+NpHFPkW7do3EeDLb8=
github.com/veraison/go-cose v1.0.0-rc.1/go.mod h1:7ziE85vSq4ScFTg6wyoMXjucIGOf4JkFEZi/an96Ct4=
github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=
Expand Down
18 changes: 9 additions & 9 deletions pkg/generated/restapi/configure_rekor_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler {
api.PubkeyGetPublicKeyHandler = pubkey.GetPublicKeyHandlerFunc(pkgapi.GetPublicKeyNotImplementedHandler)
api.TlogGetLogProofHandler = tlog.GetLogProofHandlerFunc(pkgapi.GetLogProofNotImplementedHandler)

enabled_api_endpoints := viper.GetStringSlice("enabled_api_endpoints")
if !slices.Contains(enabled_api_endpoints, "searchIndex") && viper.GetBool("enable_retrieve_api") {
enabled_api_endpoints = append(enabled_api_endpoints, "searchIndex")
enabledAPIEndpoints := viper.GetStringSlice("enabled_api_endpoints")
if !slices.Contains(enabledAPIEndpoints, "searchIndex") && viper.GetBool("enable_retrieve_api") {
enabledAPIEndpoints = append(enabledAPIEndpoints, "searchIndex")
}

for _, enabled_api := range enabled_api_endpoints {
log.Logger.Infof("Enabling API endpoint: %s", enabled_api)
switch enabled_api {
for _, enabledAPI := range enabledAPIEndpoints {
log.Logger.Infof("Enabling API endpoint: %s", enabledAPI)
switch enabledAPI {
case "searchIndex":
api.IndexSearchIndexHandler = index.SearchIndexHandlerFunc(pkgapi.SearchIndexHandler)
case "getLogInfo":
Expand All @@ -118,13 +118,13 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler {
case "searchLogQuery":
api.EntriesSearchLogQueryHandler = entries.SearchLogQueryHandlerFunc(pkgapi.SearchLogQueryHandler)
default:
log.Logger.Panicf("Unknown API endpoint requested: %s", enabled_api)
log.Logger.Panicf("Unknown API endpoint requested: %s", enabledAPI)
}
}

// all handlers need to be set before a call to api.AddMiddlewareFor
for _, enabled_api := range enabled_api_endpoints {
switch enabled_api {
for _, enabledAPI := range enabledAPIEndpoints {
switch enabledAPI {
case "searchIndex":
recordMetricsForAPI(api, "POST", "/api/v1/index/retrieve") // add metrics
case "getLogInfo":
Expand Down

0 comments on commit 994a989

Please sign in to comment.