Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #287 from neicnordic/update_go_version
Browse files Browse the repository at this point in the history
Update go version
  • Loading branch information
jbygdell authored Nov 2, 2022
2 parents 0eef884 + e5ead1f commit 12a5cfa
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 336 deletions.
7 changes: 4 additions & 3 deletions bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net/http"
"os"
"reflect"
"strings"

Expand Down Expand Up @@ -35,15 +35,16 @@ func checkS3Bucket(config S3Config) error {
_, err := s3.New(s3Session).CreateBucket(&s3.CreateBucketInput{
Bucket: aws.String(config.bucket),
})
log.Infoln(err)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
if aerr.Code() != s3.ErrCodeBucketAlreadyOwnedByYou &&
aerr.Code() != s3.ErrCodeBucketAlreadyExists {
return errors.Errorf("Unexpected issue while creating bucket: %v", err)
}

return nil
}

return errors.New("Verifying bucket failed, check S3 configuration")
}

Expand All @@ -66,7 +67,7 @@ func transportConfigS3(config S3Config) http.RoundTripper {
cfg.RootCAs = systemCAs

if config.cacert != "" {
cacert, e := ioutil.ReadFile(config.cacert) // #nosec this file comes from our config
cacert, e := os.ReadFile(config.cacert) // #nosec this file comes from our config
if e != nil {
log.Fatalf("failed to append %q to RootCAs: %v", cacert, e)
}
Expand Down
2 changes: 2 additions & 0 deletions bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ func setupFakeS3() (err error) {

if err != nil {
log.Error("Unexpected error while setting up fake s3")

return err
}

return err
}

Expand Down
10 changes: 5 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"os"
"path"
"reflect"
"strings"
Expand Down Expand Up @@ -253,7 +253,7 @@ func TLSConfigBroker(c *Config) (*tls.Config, error) {
continue
}

cacert, e := ioutil.ReadFile(cacert) // #nosec this file comes from our configuration
cacert, e := os.ReadFile(cacert) // #nosec this file comes from our configuration
if e != nil {
return nil, fmt.Errorf("failed to append %q to RootCAs: %v", cacert, e)
}
Expand All @@ -268,11 +268,11 @@ func TLSConfigBroker(c *Config) (*tls.Config, error) {
}

if c.Broker.verifyPeer {
cert, e := ioutil.ReadFile(c.Broker.clientCert)
cert, e := os.ReadFile(c.Broker.clientCert)
if e != nil {
return nil, fmt.Errorf("failed to read client cert %q, reason: %v", c.Broker.clientKey, e)
}
key, e := ioutil.ReadFile(c.Broker.clientKey)
key, e := os.ReadFile(c.Broker.clientKey)
if e != nil {
return nil, fmt.Errorf("failed to read client key %q, reason: %v", c.Broker.clientKey, e)
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func TLSConfigProxy(c *Config) (*tls.Config, error) {
cfg.RootCAs = systemCAs

if c.S3.cacert != "" {
cacert, e := ioutil.ReadFile(c.S3.cacert) // #nosec this file comes from our configuration
cacert, e := os.ReadFile(c.S3.cacert) // #nosec this file comes from our configuration
if e != nil {
return nil, fmt.Errorf("failed to append %q to RootCAs: %v", cacert, e)
}
Expand Down
40 changes: 37 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
module github.com/NBISweden/S3-Upload-Proxy

go 1.13
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.126
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/google/uuid v1.3.0
github.com/heptiolabs/healthcheck v0.0.0-20180807145615-6ff867650f40
github.com/johannesboyne/gofakes3 v0.0.0-20210608054100-92d5d4af5fde
github.com/lestrrat/go-jwx v0.0.0-20180221005942-b7d4802280ae
github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8 // indirect
github.com/minio/minio-go/v6 v6.0.43
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.13.0
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
github.com/stretchr/testify v1.8.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.13.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
github.com/shabbyrobe/gocovmerge v0.0.0-20180507124511-f6ea450bfb63 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.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
)
Loading

0 comments on commit 12a5cfa

Please sign in to comment.