Revert "don't match config in init repo (#3726)" (#3731)

This reverts commit 9a7213baa6f6858b92c47d5d28b8e39c180e64c0.

See sanity test failure: https://github.com/alcionai/corso/actions/runs/5425405323

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🐛 Bugfix

#### Test Plan

- [x] 💚 E2E
This commit is contained in:
Keepers 2023-06-30 11:50:01 -06:00 committed by GitHub
parent 9a7213baa6
commit 8f020a9c4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 8 deletions

View File

@ -40,7 +40,6 @@ func m365Overrides(in map[string]string) map[string]string {
func configureAccount( func configureAccount(
vpr *viper.Viper, vpr *viper.Viper,
readConfigFromViper bool, readConfigFromViper bool,
matchFromConfig bool,
overrides map[string]string, overrides map[string]string,
) (account.Account, error) { ) (account.Account, error) {
var ( var (
@ -50,7 +49,7 @@ func configureAccount(
err error err error
) )
if matchFromConfig { if readConfigFromViper {
m365Cfg, err = m365ConfigsFromViper(vpr) m365Cfg, err = m365ConfigsFromViper(vpr)
if err != nil { if err != nil {
return acct, clues.Wrap(err, "reading m365 configs from corso config file") return acct, clues.Wrap(err, "reading m365 configs from corso config file")

View File

@ -284,7 +284,7 @@ func getStorageAndAccountWithViper(
config.RepoID = vpr.GetString(RepoID) config.RepoID = vpr.GetString(RepoID)
} }
config.Account, err = configureAccount(vpr, readConfigFromViper, mustMatchFromConfig, overrides) config.Account, err = configureAccount(vpr, readConfigFromViper, overrides)
if err != nil { if err != nil {
return config, clues.Wrap(err, "retrieving account configuration details") return config, clues.Wrap(err, "retrieving account configuration details")
} }

View File

@ -270,7 +270,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() {
err = vpr.ReadInConfig() err = vpr.ReadInConfig()
require.NoError(t, err, "reading repo config", clues.ToCore(err)) require.NoError(t, err, "reading repo config", clues.ToCore(err))
config, err := getStorageAndAccountWithViper(vpr, true, true, nil) config, err := getStorageAndAccountWithViper(vpr, true, false, nil)
require.NoError(t, err, "getting storage and account from config", clues.ToCore(err)) require.NoError(t, err, "getting storage and account from config", clues.ToCore(err))
readS3Cfg, err := config.Storage.S3Config() readS3Cfg, err := config.Storage.S3Config()

View File

@ -69,6 +69,10 @@ func configureStorage(
) )
if readConfigFromViper { if readConfigFromViper {
if s3Cfg, err = s3ConfigsFromViper(vpr); err != nil {
return store, clues.Wrap(err, "reading s3 configs from corso config file")
}
if b, ok := overrides[storage.Bucket]; ok { if b, ok := overrides[storage.Bucket]; ok {
overrides[storage.Bucket] = common.NormalizeBucket(b) overrides[storage.Bucket] = common.NormalizeBucket(b)
} }
@ -79,10 +83,6 @@ func configureStorage(
} }
if matchFromConfig { if matchFromConfig {
if s3Cfg, err = s3ConfigsFromViper(vpr); err != nil {
return store, clues.Wrap(err, "reading s3 configs from corso config file")
}
if err := mustMatchConfig(vpr, s3Overrides(overrides)); err != nil { if err := mustMatchConfig(vpr, s3Overrides(overrides)); err != nil {
return store, clues.Wrap(err, "verifying s3 configs in corso config file") return store, clues.Wrap(err, "verifying s3 configs in corso config file")
} }