Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

175 aws region #176

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/template/localConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
---
minio:
address: 0.0.0.0
# aws need to include the region in the bucket. eg: s3.us-west-2.amazonaws.com
port: 9000
accessKey: worldsbestaccesskey
secretKey: worldsbestsecretkey
Expand Down
3 changes: 2 additions & 1 deletion internal/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (

// ConnCheck check the connections with a list buckets call
func ConnCheck(mc *minio.Client) error {
_, err := mc.ListBuckets(context.Background())
bcukets, err := mc.ListBuckets(context.Background())
log.Debug("list buckets", bcukets)
return err
}

Expand Down
8 changes: 7 additions & 1 deletion internal/common/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ func MinioConnection(v1 *viper.Viper) *minio.Client {
accessKeyID := mcfg.Accesskey
secretAccessKey := mcfg.Secretkey
useSSL := mcfg.Ssl
// auth fails if a region is set in minioclient...
// region := mcfg.Region

minioClient, err := minio.New(endpoint,
&minio.Options{Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
Secure: useSSL})
Secure: useSSL,
// Region: region,
})

// minioClient.SetCustomTransport(&http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}})
if err != nil {
log.Fatal(err)
}
// don't set region until you created the client
return minioClient
}
2 changes: 2 additions & 0 deletions internal/config/gleanerConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"github.com/spf13/viper"
)

// auth fails if a region is set in minioclient...
var gleanerTemplate = map[string]interface{}{
"minio": map[string]string{
"address": "localhost",
"port": "9000",
"accesskey": "",
"secretkey": "",
// "region": "us-east-1",
},
"gleaner": map[string]string{},
"context": map[string]string{},
Expand Down
3 changes: 3 additions & 0 deletions internal/config/localConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"github.com/spf13/viper"
)

// auth fails if a region is set in minioclient...
var serversTemplate = map[string]interface{}{
"minio": map[string]string{
"address": "localhost",
"port": "9000",
"accesskey": "",
"secretkey": "",
"bucket": "",
// "region": "us-east-1",
},
"sparql": map[string]string{
"endpoint": "localhost",
Expand All @@ -34,6 +36,7 @@ func ReadServersConfig(filename string, cfgDir string) (*viper.Viper, error) {
v.BindEnv("minio.accesskey", "MINIO_ACCESS_KEY")
v.BindEnv("minio.secretkey", "MINIO_SECRET_KEY")
v.BindEnv("minio.bucket", "MINIO_BUCKET")
// v.BindEnv("minio.region", "MINIO_REGION")
v.BindEnv("sparql.endpoint", "SPARQL_ENDPOINT")
v.BindEnv("sparql.authenticate", "SPARQL_AUTHENTICATE")
v.BindEnv("sparql.username", "SPARQL_USERNAME")
Expand Down
5 changes: 5 additions & 0 deletions internal/config/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/spf13/viper"
)

// auth fails if a region is set in minioclient...
// frig frig... do not use lowercase... those are private variables
type Minio struct {
Address string // `mapstructure:"MINIO_ADDRESS"`
Expand All @@ -13,8 +14,10 @@ type Minio struct {
Accesskey string //`mapstructure:"MINIO_ACCESS_KEY"`
Secretkey string // `mapstructure:"MINIO_SECRET_KEY"`
Bucket string
// Region string
}

// auth fails if a region is set in minioclient...
var MinioTemplate = map[string]interface{}{
"minio": map[string]string{
"address": "localhost",
Expand All @@ -23,6 +26,7 @@ var MinioTemplate = map[string]interface{}{
"secretkey": "",
"bucket": "",
"ssl": "false",
// "region": "us-east-1",
},
}

Expand All @@ -39,6 +43,7 @@ func ReadMinioConfig(minioSubtress *viper.Viper) (Minio, error) {
minioSubtress.BindEnv("secretkey", "MINIO_SECRET_KEY")
minioSubtress.BindEnv("secretkey", "MINIO_SECRET_KEY")
minioSubtress.BindEnv("bucket", "MINIO_BUCKET")
// minioSubtress.BindEnv("region", "MINIO_REGION")
minioSubtress.AutomaticEnv()
// config already read. substree passed
err := minioSubtress.Unmarshal(&minioCfg)
Expand Down