Skip to content

Commit

Permalink
Update docstrings. Remove unused variable in binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdalmo committed Jul 19, 2018
1 parent 5359a2f commit 912b74e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 3 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ import (
environment "github.com/telia-oss/aws-env"
)

const (
cmdDelim = "--"
)

var command rootCommand

type rootCommand struct {
Exec execCommand `command:"exec" description:"Execute a command."`
}

type execCommand struct{}

// Execute command
// Execute the exec subcommand.
func (c *execCommand) Execute(args []string) error {
if len(args) <= 0 {
return errors.New("please supply a command to run")
Expand Down Expand Up @@ -53,6 +47,8 @@ func (c *execCommand) Execute(args []string) error {
return nil
}

var command rootCommand

func main() {
_, err := flags.Parse(&command)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ type SSMClient ssmiface.SSMAPI
//go:generate mockgen -destination=mocks/mock_kms_client.go -package=mocks github.com/telia-oss/aws-env KMSClient
type KMSClient kmsiface.KMSAPI

// NewTestManager for testing purposes.
func NewTestManager(sm SMClient, ssm SSMClient, kms KMSClient) *Manager {
return &Manager{sm: sm, ssm: ssm, kms: kms}
}

// Manager handles API calls to AWS.
type Manager struct {
sm SMClient
ssm SSMClient
kms KMSClient
}

// New creates a new manager for handling AWS API calls.
// New creates a new manager for populating secret values.
func New(sess *session.Session) (*Manager, error) {
var (
region string
Expand All @@ -70,12 +75,7 @@ func New(sess *session.Session) (*Manager, error) {
}, nil
}

// NewTestManager ...
func NewTestManager(sm SMClient, ssm SSMClient, kms KMSClient) *Manager {
return &Manager{sm: sm, ssm: ssm, kms: kms}
}

// Populate all environment variables with their secrets.
// Populate environment variables with their secret values from either Secrets manager, SSM Parameter store or KMS.
func (m *Manager) Populate() error {
env := make(map[string]string)
for _, v := range os.Environ() {
Expand Down

0 comments on commit 912b74e

Please sign in to comment.