chore: declare explicit configs

This commit is contained in:
Reinaldy Rafli 2022-12-03 08:51:51 +07:00
parent f75e545bc5
commit 7dec072679
Signed by: aldy505
GPG Key ID: 1DAB793F100A560A
1 changed files with 182 additions and 170 deletions

View File

@ -35,6 +35,16 @@ func main() {
minioHost = "localhost:9000" minioHost = "localhost:9000"
} }
minioRegion, ok := os.LookupEnv("MINIO_REGION")
if !ok {
minioRegion = ""
}
minioSecure, ok := os.LookupEnv("MINIO_SECURE")
if !ok {
minioSecure = "false"
}
minioID, ok := os.LookupEnv("MINIO_ACCESS_ID") minioID, ok := os.LookupEnv("MINIO_ACCESS_ID")
if !ok { if !ok {
minioID = "minio" minioID = "minio"
@ -80,6 +90,8 @@ func main() {
// Setup MinIO // Setup MinIO
minioClient, err := minio.New(minioHost, &minio.Options{ minioClient, err := minio.New(minioHost, &minio.Options{
Creds: credentials.NewStaticV4(minioID, minioSecret, minioToken), Creds: credentials.NewStaticV4(minioID, minioSecret, minioToken),
Region: minioRegion,
Secure: minioSecure == "true",
}) })
if err != nil { if err != nil {
log.Fatalf("setting up minio client: %s", err.Error()) log.Fatalf("setting up minio client: %s", err.Error())