Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
feat: renamed package (#61)
Browse files Browse the repository at this point in the history
- Renamed package from config to cfg.
  • Loading branch information
Taliesin Millhouse authored May 15, 2021
1 parent edc4165 commit f028c59
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package cfg

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package cfg

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/gofor-little/config
module github.com/gofor-little/cfg

go 1.16

Expand Down
10 changes: 5 additions & 5 deletions tests/integration/integration_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config_test
package cfg_test

import (
"encoding/json"
Expand All @@ -11,7 +11,7 @@ import (
"github.com/gofor-little/env"
"github.com/stretchr/testify/require"

"github.com/gofor-little/config"
"github.com/gofor-little/cfg"
)

type TestConfig struct {
Expand All @@ -24,7 +24,7 @@ func setup(t *testing.T) string {
t.Logf("failed to load .env file, ignore if running in CI/CD: %v", err)
}

require.NoError(t, config.Initialize(env.Get("AWS_PROFILE", ""), env.Get("AWS_REGION", "")))
require.NoError(t, cfg.Initialize(env.Get("AWS_PROFILE", ""), env.Get("AWS_REGION", "")))

kmsKeyArn, err := env.MustGet("TEST_KMS_KEY_ARN")
require.NoError(t, err)
Expand All @@ -39,7 +39,7 @@ func setup(t *testing.T) string {
}
require.NoError(t, input.Validate())

output, err := config.SecretsManagerClient.CreateSecret(input)
output, err := cfg.SecretsManagerClient.CreateSecret(input)
require.NoError(t, err)

return *output.ARN
Expand All @@ -52,6 +52,6 @@ func teardown(t *testing.T, secretArn string) {
}
require.NoError(t, input.Validate())

_, err := config.SecretsManagerClient.DeleteSecret(input)
_, err := cfg.SecretsManagerClient.DeleteSecret(input)
require.NoError(t, err)
}
6 changes: 3 additions & 3 deletions tests/integration/load_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config_test
package cfg_test

import (
"context"
Expand All @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/gofor-little/config"
"github.com/gofor-little/cfg"
)

func TestLoad(t *testing.T) {
Expand All @@ -25,7 +25,7 @@ func TestLoad(t *testing.T) {
name := fmt.Sprintf("%s_%d", tc.name, i)

t.Run(name, func(t *testing.T) {
require.Equal(t, tc.want, config.Load(context.Background(), secretArn, &TestConfig{}))
require.Equal(t, tc.want, cfg.Load(context.Background(), secretArn, &TestConfig{}))
})
}
}
6 changes: 3 additions & 3 deletions tests/unit/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/gofor-little/aws-sdk-mock"

"github.com/gofor-little/config"
"github.com/gofor-little/cfg"
)

func TestLoad(t *testing.T) {
config.SecretsManagerClient = &mock.SecretsManagerClient{}
cfg.SecretsManagerClient = &mock.SecretsManagerClient{}

testCases := []struct {
name string
Expand All @@ -26,7 +26,7 @@ func TestLoad(t *testing.T) {
name := fmt.Sprintf("%s_%d", tc.name, i)

t.Run(name, func(t *testing.T) {
require.Equal(t, tc.want, config.Load(context.Background(), tc.secretArn, &struct {
require.Equal(t, tc.want, cfg.Load(context.Background(), tc.secretArn, &struct {
Key1 string `json:"key-1"`
Key2 string `json:"key-2"`
}{}))
Expand Down

0 comments on commit f028c59

Please sign in to comment.