remove getting s3 config from envvars (#3757)
<!-- PR description--> S3 configs like BUCKET and PREFIX are common env vars and can cause overkills. Remove these S3 configs to avoid confusion. #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
83e56ed396
commit
9f334f7d30
@ -1,7 +1,6 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -14,7 +13,6 @@ import (
|
||||
"github.com/alcionai/corso/src/cli/flags"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common/str"
|
||||
"github.com/alcionai/corso/src/internal/events"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
"github.com/alcionai/corso/src/pkg/credentials"
|
||||
@ -126,8 +124,6 @@ func initS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// s3 values from flags
|
||||
s3Override := S3Overrides(cmd)
|
||||
// s3 values from envs
|
||||
s3Override = S3UpdateFromEnvVar(cmd, s3Override)
|
||||
|
||||
cfg, err := config.GetConfigRepoDetails(ctx, true, false, s3Override)
|
||||
if err != nil {
|
||||
@ -202,8 +198,6 @@ func connectS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// s3 values from flags
|
||||
s3Override := S3Overrides(cmd)
|
||||
// s3 values from envs
|
||||
s3Override = S3UpdateFromEnvVar(cmd, s3Override)
|
||||
|
||||
cfg, err := config.GetConfigRepoDetails(ctx, true, true, s3Override)
|
||||
if err != nil {
|
||||
@ -292,15 +286,3 @@ func PopulateS3Flags(flagset flags.PopulatedFlags) map[string]string {
|
||||
|
||||
return s3Overrides
|
||||
}
|
||||
|
||||
func S3UpdateFromEnvVar(cmd *cobra.Command, s3Flag map[string]string) map[string]string {
|
||||
s3Flag[storage.Bucket] = str.First(s3Flag[storage.Bucket], os.Getenv(storage.BucketKey))
|
||||
s3Flag[storage.Endpoint] = str.First(s3Flag[storage.Endpoint], os.Getenv(storage.EndpointKey))
|
||||
s3Flag[storage.Prefix] = str.First(s3Flag[storage.Prefix], os.Getenv(storage.PrefixKey))
|
||||
s3Flag[storage.DoNotUseTLS] = str.First(s3Flag[storage.DoNotUseTLS], os.Getenv(storage.DisableTLSKey))
|
||||
s3Flag[storage.DoNotVerifyTLS] = str.First(
|
||||
s3Flag[storage.DoNotVerifyTLS],
|
||||
os.Getenv(storage.DisableTLSVerificationKey))
|
||||
|
||||
return s3Flag
|
||||
}
|
||||
|
||||
@ -21,16 +21,6 @@ var (
|
||||
errMissingRequired = clues.New("missing required storage configuration")
|
||||
)
|
||||
|
||||
// envvar consts
|
||||
// TODO: Remove these and leverage Viper AutomaticEnv() instead
|
||||
const (
|
||||
BucketKey = "BUCKET"
|
||||
EndpointKey = "ENDPOINT"
|
||||
PrefixKey = "PREFIX"
|
||||
DisableTLSKey = "DISABLE_TLS"
|
||||
DisableTLSVerificationKey = "DISABLE_TLS_VERIFICATION"
|
||||
)
|
||||
|
||||
// Storage defines a storage provider, along with any configuration
|
||||
// required to set up or communicate with that provider.
|
||||
type Storage struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user