Skip to content

Commit

Permalink
chore: udpate dependencies (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored Jul 28, 2023
1 parent 752c725 commit f9bc7fa
Show file tree
Hide file tree
Showing 818 changed files with 324,246 additions and 31,220 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linters:
- structcheck # deprecated
- usestdlibvars # needs to be fixed
- exhaustruct # needs to be fixed
- depguard

issues:
exclude-rules:
Expand Down
2 changes: 1 addition & 1 deletion client/delete_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestDeleteFile(t *testing.T) {
expectedErr: &client.APIResponseError{
StatusCode: 400,
ErrorResponse: &controller.ErrorResponse{
Message: `Message: invalid input syntax for type uuid: "asdadasdads", Locations: []`,
Message: "Message: invalid input syntax for type uuid: \"asdadasdads\", Locations: [], Extensions: map[code:data-exception path:$]",
},
Response: nil,
},
Expand Down
4 changes: 2 additions & 2 deletions client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ var (
)

type APIResponseError struct {
StatusCode int
StatusCode int `json:"statusCode"`
*controller.ErrorResponse
Response interface{}
Response interface{} `json:"response"`
}

func (err *APIResponseError) Error() string {
Expand Down
2 changes: 1 addition & 1 deletion client/get_file_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestGetFileInformation(t *testing.T) {
expectedErr: &client.APIResponseError{
StatusCode: 400,
ErrorResponse: &controller.ErrorResponse{
Message: `Message: invalid input syntax for type uuid: "asdadasdads", Locations: []`,
Message: "Message: invalid input syntax for type uuid: \"asdadasdads\", Locations: [], Extensions: map[code:data-exception path:$]",
},
Response: nil,
},
Expand Down
2 changes: 1 addition & 1 deletion client/get_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func TestGetFile(t *testing.T) {
expectedErr: &client.APIResponseError{
StatusCode: 400,
ErrorResponse: &controller.ErrorResponse{
Message: `Message: invalid input syntax for type uuid: "asdadasdads", Locations: []`,
Message: "Message: invalid input syntax for type uuid: \"asdadasdads\", Locations: [], Extensions: map[code:data-exception path:$]",
},
Response: nil,
},
Expand Down
2 changes: 1 addition & 1 deletion client/update_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestUpdateFile(t *testing.T) {
expectedErr: &client.APIResponseError{
StatusCode: 400,
ErrorResponse: &controller.ErrorResponse{
Message: `Message: invalid input syntax for type uuid: "asdadasdads", Locations: []`,
Message: "Message: invalid input syntax for type uuid: \"asdadasdads\", Locations: [], Extensions: map[code:data-exception path:$]",
},
Response: nil,
},
Expand Down
4 changes: 2 additions & 2 deletions client/upload_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ func TestUploadFile(t *testing.T) {
expectedErr: &client.APIResponseError{
StatusCode: http.StatusBadRequest,
ErrorResponse: &controller.ErrorResponse{
Message: `Message: Uniqueness violation. duplicate key value violates unique constraint "files_pkey", Locations: []`,
Message: `Message: Uniqueness violation. duplicate key value violates unique constraint "files_pkey", Locations: [], Extensions: map[code:constraint-violation path:$.selectionSet.insertFiles.args.objects]`,
Data: nil,
},
Response: &controller.UploadFileResponse{
Error: &controller.ErrorResponse{Message: "Message: Uniqueness violation. duplicate key value violates unique constraint \"files_pkey\", Locations: []"},
Error: &controller.ErrorResponse{Message: "Message: Uniqueness violation. duplicate key value violates unique constraint \"files_pkey\", Locations: [], Extensions: map[code:constraint-violation path:$.selectionSet.insertFiles.args.objects]"},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/viper"
)

func addBoolFlag(flags *pflag.FlagSet, name string, defaultValue bool, help string) {
func addBoolFlag(flags *pflag.FlagSet, name string, defaultValue bool, help string) { //nolint:unparam
flags.Bool(name, defaultValue, help)
if err := viper.BindPFlag(name, flags.Lookup(name)); err != nil {
cobra.CheckErr(err)
Expand Down
8 changes: 5 additions & 3 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const (
postgresMigrationsSourceFlag = "postgres-migrations-source"
fastlyServiceFlag = "fastly-service"
fastlyKeyFlag = "fastly-key"
corsAllowOriginsFlag = "cors-allow-origins"
corsAllowCredentialsFlag = "cors-allow-credentials"
corsAllowOriginsFlag = "cors-allow-origins"
corsAllowCredentialsFlag = "cors-allow-credentials" //nolint: gosec
)

func ginLogger(logger *logrus.Logger) gin.HandlerFunc {
Expand Down Expand Up @@ -111,7 +111,9 @@ func getGin(
middlewares = append(middlewares, fastly.New(fastlyService, viper.GetString(fastlyKeyFlag), logger))
}

return ctrl.SetupRouter(trustedProxies, apiRootPrefix, corsAllowOrigins, corsAllowCredentials, middlewares...) //nolint: wrapcheck
return ctrl.SetupRouter( //nolint: wrapcheck
trustedProxies, apiRootPrefix, corsAllowOrigins, corsAllowCredentials, middlewares...,
)
}

func getMetadataStorage(endpoint string) *metadata.Hasura {
Expand Down
31 changes: 17 additions & 14 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ func New(
}
}

func corsConfig(allowedOrigins []string) cors.Config {
return cors.Config{
AllowOrigins: allowedOrigins,
AllowMethods: []string{"GET", "PUT", "POST", "HEAD", "DELETE"},
AllowHeaders: []string{
"Authorization", "Origin", "if-match", "if-none-match", "if-modified-since", "if-unmodified-since",
"x-hasura-admin-secret", "x-nhost-bucket-id", "x-nhost-file-name", "x-nhost-file-id",
"x-hasura-role",
},
ExposeHeaders: []string{
"Content-Length", "Content-Type", "Cache-Control", "ETag", "Last-Modified", "X-Error",
},
MaxAge: 12 * time.Hour, //nolint: gomnd
}
}

func (ctrl *Controller) SetupRouter(
trustedProxies []string,
apiRootPrefix string,
Expand All @@ -130,20 +146,7 @@ func (ctrl *Controller) SetupRouter(
router.Use(mw)
}

corsConfig := cors.Config{
AllowOrigins: corsOrigins,
AllowMethods: []string{"GET", "PUT", "POST", "HEAD", "DELETE"},
AllowHeaders: []string{
"Authorization", "Origin", "if-match", "if-none-match", "if-modified-since", "if-unmodified-since",
"x-hasura-admin-secret", "x-nhost-bucket-id", "x-nhost-file-name", "x-nhost-file-id",
"x-hasura-role",
},
ExposeHeaders: []string{
"Content-Length", "Content-Type", "Cache-Control", "ETag", "Last-Modified", "X-Error",
},
MaxAge: 12 * time.Hour, //nolint: gomnd
}

corsConfig := corsConfig(corsOrigins)
if corsAllowCredentials {
corsConfig.AllowCredentials = true
}
Expand Down
2 changes: 1 addition & 1 deletion controller/get_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func getQueryFloat(ctx *gin.Context, param string) (float64, *APIError) {
if !ok {
return 0, nil
}
x, err := strconv.ParseFloat(s, 32) //nolint: gomnd
x, err := strconv.ParseFloat(s, 32)
if err != nil {
return 0, BadDataError(err, fmt.Sprintf("query parameter %s must be an int", param))
}
Expand Down
8 changes: 4 additions & 4 deletions controller/get_file_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ func (ctrl *Controller) getFileMetadata(
}

type getFileInformationHeaders struct {
IfMatch []string `header:"if-match"`
IfNoneMatch []string `header:"if-none-match"`
IfModifiedSince string `header:"if-modified-since"`
IfUnmodifiedSince string `header:"if-unmodified-since"`
IfMatch []string `header:"If-Match"`
IfNoneMatch []string `header:"If-None-Match"`
IfModifiedSince string `header:"If-Modified-Since"`
IfUnmodifiedSince string `header:"If-Unmodified-Since"`
}

type getFileRequest struct {
Expand Down
36 changes: 27 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 34 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,65 +1,64 @@
module github.com/nhost/hasura-storage

go 1.19
go 1.20

require (
github.com/aws/aws-sdk-go v1.44.162
github.com/gabriel-vasile/mimetype v1.4.1
github.com/aws/aws-sdk-go v1.44.309
github.com/gabriel-vasile/mimetype v1.4.2
github.com/gin-contrib/cors v1.4.0
github.com/gin-gonic/gin v1.8.1
github.com/golang-migrate/migrate/v4 v4.15.2
github.com/gin-gonic/gin v1.9.1
github.com/golang-migrate/migrate/v4 v4.16.2
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/hasura/go-graphql-client v0.8.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
github.com/hasura/go-graphql-client v0.9.3
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.14.0
golang.org/x/net v0.4.0
github.com/spf13/viper v1.16.0
golang.org/x/net v0.12.0
)

require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/containerd/containerd v1.6.13 // indirect
github.com/bytedance/sonic v1.10.0-rc3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.13 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/tools v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
Loading

0 comments on commit f9bc7fa

Please sign in to comment.