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

support ENV import #2

Merged
merged 5 commits into from
Sep 25, 2018
Merged

support ENV import #2

merged 5 commits into from
Sep 25, 2018

Conversation

SammyLin
Copy link
Contributor

@SammyLin SammyLin commented Sep 7, 2018

No description provided.

cmd/root.go Outdated
GCPprojectID string
GCPlocationID string
GCPkeyRingID string
GCPcryptoKeyID string
Perfix string
)

var CryptoTypeName = map[int32]string{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just const string?

type CryptoType string
CryptoTypeText CryptoType = "text"
CryptoTypeEnv CryptoType = "env"

type Impoter func(args, perfix string) []Key
type Expoter func(keys []Key)

Impoters = map[CryptoType]Impoter{
  CryptoTypeText: FlagsImporter,
  CryptoTypeEnv: EnvsImporter,
}
Expoters = map[CryptoType]Expoter{
  CryptoTypeText: FlagsExporter,
  CryptoTypeEnv: EnvsExporter,
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could reduct the number of if...else

2. modify Keys interface to
  Import(input []string, perfix string) []Key
  Export(keys []Key)
3. let encrypt() and decryt() determine the input while calling
keys.Import()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants