rename password to passphrase (#796)
General user friendliness renaming. Will cause a breaking change in any local environment for developers and Ark.
This commit is contained in:
parent
432f984e61
commit
110e874e5b
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||
CORSO_CI_TESTS: true
|
||||
CORSO_M356_TEST_USER_ID: ${{ secrets.CORSO_M356_TEST_USER_ID }}
|
||||
CORSO_PASSWORD: ${{ secrets.INTEGRATION_TEST_CORSO_PASSWORD }}
|
||||
CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }}
|
||||
TENANT_ID: ${{ secrets.TENANT_ID }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@ -237,7 +237,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() {
|
||||
|
||||
common, err := st.CommonConfig()
|
||||
require.NoError(t, err, "reading common config from storage")
|
||||
assert.Equal(t, common.CorsoPassword, os.Getenv(credentials.CorsoPassword))
|
||||
assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase))
|
||||
|
||||
readM365, err := ac.M365Config()
|
||||
require.NoError(t, err, "reading m365 config from account")
|
||||
@ -285,7 +285,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount_noFileOnlyOverride
|
||||
|
||||
common, err := st.CommonConfig()
|
||||
require.NoError(t, err, "reading common config from storage")
|
||||
assert.Equal(t, common.CorsoPassword, os.Getenv(credentials.CorsoPassword))
|
||||
assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase))
|
||||
|
||||
readM365, err := ac.M365Config()
|
||||
require.NoError(t, err, "reading m365 config from account")
|
||||
|
||||
@ -92,8 +92,8 @@ func configureStorage(
|
||||
|
||||
// ensure required properties are present
|
||||
if err := utils.RequireProps(map[string]string{
|
||||
storage.Bucket: s3Cfg.Bucket,
|
||||
credentials.CorsoPassword: corso.CorsoPassword,
|
||||
storage.Bucket: s3Cfg.Bucket,
|
||||
credentials.CorsoPassphrase: corso.CorsoPassphrase,
|
||||
}); err != nil {
|
||||
return storage.Storage{}, err
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ const (
|
||||
|
||||
var (
|
||||
corsoEVs = []envVar{
|
||||
{corso, "CORSO_PASSWORD", "Passphrase to protect repository encryption material." +
|
||||
{corso, "CORSO_PASSPHRASE", "Passphrase to protect repository encryption material." +
|
||||
"It is impossible to use the repository or recover any backups without this key."},
|
||||
}
|
||||
azureEVs = []envVar{
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/path"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
@ -526,7 +527,7 @@ func (suite *ExchangeServiceSuite) TestGetRestoreContainer() {
|
||||
for _, test := range tests {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
containerID, err := GetRestoreContainer(suite.es, userID, test.option)
|
||||
require.True(t, test.checkError(t, err))
|
||||
require.True(t, test.checkError(t, err, support.ConnectorStackErrorTrace(err)))
|
||||
|
||||
if test.cleanupFunc != nil {
|
||||
err = test.cleanupFunc(suite.es, userID, containerID)
|
||||
|
||||
@ -67,7 +67,7 @@ func (w *conn) Initialize(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// todo - issue #75: nil here should be a storage.NewRepoOptions()
|
||||
if err = repo.Initialize(ctx, bst, nil, cfg.CorsoPassword); err != nil {
|
||||
if err = repo.Initialize(ctx, bst, nil, cfg.CorsoPassphrase); err != nil {
|
||||
if errors.Is(err, repo.ErrAlreadyInitialized) {
|
||||
return RepoAlreadyExistsError(err)
|
||||
}
|
||||
@ -79,7 +79,7 @@ func (w *conn) Initialize(ctx context.Context) error {
|
||||
ctx,
|
||||
cfg.KopiaCfgDir,
|
||||
bst,
|
||||
cfg.CorsoPassword,
|
||||
cfg.CorsoPassphrase,
|
||||
defaultCompressor,
|
||||
)
|
||||
}
|
||||
@ -100,7 +100,7 @@ func (w *conn) Connect(ctx context.Context) error {
|
||||
ctx,
|
||||
cfg.KopiaCfgDir,
|
||||
bst,
|
||||
cfg.CorsoPassword,
|
||||
cfg.CorsoPassphrase,
|
||||
defaultCompressor,
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,28 +8,28 @@ import (
|
||||
|
||||
// envvar consts
|
||||
const (
|
||||
CorsoPassword = "CORSO_PASSWORD"
|
||||
CorsoPassphrase = "CORSO_PASSPHRASE"
|
||||
)
|
||||
|
||||
// Corso aggregates corso credentials from flag and env_var values.
|
||||
type Corso struct {
|
||||
CorsoPassword string // required
|
||||
CorsoPassphrase string // required
|
||||
}
|
||||
|
||||
// GetCorso is a helper for aggregating Corso secrets and credentials.
|
||||
func GetCorso() Corso {
|
||||
// todo (rkeeprs): read from either corso config file or env vars.
|
||||
// https://github.com/alcionai/corso/issues/120
|
||||
corsoPasswd := os.Getenv(CorsoPassword)
|
||||
corsoPassph := os.Getenv(CorsoPassphrase)
|
||||
|
||||
return Corso{
|
||||
CorsoPassword: corsoPasswd,
|
||||
CorsoPassphrase: corsoPassph,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Corso) Validate() error {
|
||||
check := map[string]string{
|
||||
CorsoPassword: c.CorsoPassword,
|
||||
CorsoPassphrase: c.CorsoPassphrase,
|
||||
}
|
||||
|
||||
for k, v := range check {
|
||||
|
||||
@ -7,15 +7,15 @@ import (
|
||||
)
|
||||
|
||||
type CommonConfig struct {
|
||||
credentials.Corso // requires: CorsoPassword
|
||||
credentials.Corso // requires: CorsoPassphrase
|
||||
|
||||
KopiaCfgDir string
|
||||
}
|
||||
|
||||
// config key consts
|
||||
const (
|
||||
keyCommonCorsoPassword = "common_corsoPassword"
|
||||
keyCommonKopiaCfgDir = "common_kopiaCfgDir"
|
||||
keyCommonCorsoPassphrase = "common_corsoPassphrase"
|
||||
keyCommonKopiaCfgDir = "common_kopiaCfgDir"
|
||||
)
|
||||
|
||||
// StringConfig transforms a commonConfig struct into a plain
|
||||
@ -23,8 +23,8 @@ const (
|
||||
// serialize into the map are expected to be strings.
|
||||
func (c CommonConfig) StringConfig() (map[string]string, error) {
|
||||
cfg := map[string]string{
|
||||
keyCommonCorsoPassword: c.CorsoPassword,
|
||||
keyCommonKopiaCfgDir: c.KopiaCfgDir,
|
||||
keyCommonCorsoPassphrase: c.CorsoPassphrase,
|
||||
keyCommonKopiaCfgDir: c.KopiaCfgDir,
|
||||
}
|
||||
|
||||
return cfg, c.validate()
|
||||
@ -35,7 +35,7 @@ func (s Storage) CommonConfig() (CommonConfig, error) {
|
||||
c := CommonConfig{}
|
||||
|
||||
if len(s.Config) > 0 {
|
||||
c.CorsoPassword = orEmptyString(s.Config[keyCommonCorsoPassword])
|
||||
c.CorsoPassphrase = orEmptyString(s.Config[keyCommonCorsoPassphrase])
|
||||
c.KopiaCfgDir = orEmptyString(s.Config[keyCommonKopiaCfgDir])
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ func (s Storage) CommonConfig() (CommonConfig, error) {
|
||||
|
||||
// ensures all required properties are present
|
||||
func (c CommonConfig) validate() error {
|
||||
if len(c.CorsoPassword) == 0 {
|
||||
return errors.Wrap(errMissingRequired, credentials.CorsoPassword)
|
||||
if len(c.CorsoPassphrase) == 0 {
|
||||
return errors.Wrap(errMissingRequired, credentials.CorsoPassphrase)
|
||||
}
|
||||
|
||||
// kopiaCfgFilePath is not required
|
||||
|
||||
@ -20,7 +20,7 @@ func TestCommonCfgSuite(t *testing.T) {
|
||||
|
||||
var goodCommonConfig = storage.CommonConfig{
|
||||
Corso: credentials.Corso{
|
||||
CorsoPassword: "passwd",
|
||||
CorsoPassphrase: "passph",
|
||||
},
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ func (suite *CommonCfgSuite) TestCommonConfig_Config() {
|
||||
key string
|
||||
expect string
|
||||
}{
|
||||
{"common_corsoPassword", cfg.CorsoPassword},
|
||||
{"common_corsoPassphrase", cfg.CorsoPassphrase},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.T().Run(test.key, func(t *testing.T) {
|
||||
@ -51,7 +51,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig() {
|
||||
out, err := s.CommonConfig()
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, in.CorsoPassword, out.CorsoPassword)
|
||||
assert.Equal(t, in.CorsoPassphrase, out.CorsoPassphrase)
|
||||
}
|
||||
|
||||
func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
||||
@ -60,7 +60,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
||||
name string
|
||||
cfg storage.CommonConfig
|
||||
}{
|
||||
{"missing password", storage.CommonConfig{}},
|
||||
{"missing passphrase", storage.CommonConfig{}},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
@ -75,9 +75,9 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
||||
amend func(storage.Storage)
|
||||
}{
|
||||
{
|
||||
"missing password",
|
||||
"missing passphrase",
|
||||
func(s storage.Storage) {
|
||||
s.Config["common_corsoPassword"] = ""
|
||||
s.Config["common_corsoPassphrase"] = ""
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user