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

feat!: don't load products and apps paths #143

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

type Config struct {
Service string
Product string
Environment string
Region string
}
Expand All @@ -16,8 +15,6 @@ func (c *Config) ConsulPaths() []string {
return []string{
"global/env_vars",
fmt.Sprintf("global/%s/env_vars", c.Environment),
fmt.Sprintf("products/%s/env_vars", c.Product), // DEPRECATED
fmt.Sprintf("apps/%s/%s/env_vars", c.Service, c.Environment), // DEPRECATED
fmt.Sprintf("services/%s/env_vars", c.Service),
fmt.Sprintf("services/%s/%s/env_vars", c.Service, c.Environment),
}
Expand All @@ -29,17 +26,13 @@ func (c *Config) VaultPaths() []string {
return []string{
"secret/global/env_vars",
fmt.Sprintf("secret/global/%s/env_vars", c.Environment),
fmt.Sprintf("secret/products/%s/env_vars", c.Product), // DEPRECATED
fmt.Sprintf("secret/apps/%s/%s/env_vars", c.Service, c.Environment), // DEPRECATED
fmt.Sprintf("secret/services/%s/env_vars", c.Service),
fmt.Sprintf("secret/services/%s/%s/env_vars", c.Service, c.Environment),
}
}

return []string{
fmt.Sprintf("secret/global/%s/env_vars", c.Environment),
fmt.Sprintf("secret/products/%s/%s/env_vars", c.Product, c.Environment), // DEPRECATED
fmt.Sprintf("secret/apps/%s/%s/env_vars", c.Service, c.Environment), // DEPRECATED
fmt.Sprintf("secret/services/%s/%s/env_vars", c.Service, c.Environment),
}
}
10 changes: 0 additions & 10 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import (
func TestConfig_ConsulPaths(t *testing.T) {
c := Config{
Service: "foo",
Product: "bar",
Environment: "stage",
}

assert.Equal(t, []string{
"global/env_vars",
"global/stage/env_vars",
"products/bar/env_vars",
"apps/foo/stage/env_vars",
"services/foo/env_vars",
"services/foo/stage/env_vars",
}, c.ConsulPaths())
Expand All @@ -26,15 +23,12 @@ func TestConfig_ConsulPaths(t *testing.T) {
func TestConfig_VaultPaths(t *testing.T) {
c := Config{
Service: "foo",
Product: "bar",
Environment: "stage",
}

assert.Equal(t, []string{
"secret/global/env_vars",
"secret/global/stage/env_vars",
"secret/products/bar/env_vars",
"secret/apps/foo/stage/env_vars",
"secret/services/foo/env_vars",
"secret/services/foo/stage/env_vars",
}, c.VaultPaths())
Expand All @@ -43,17 +37,13 @@ func TestConfig_VaultPaths(t *testing.T) {
assert.Equal(t, []string{
"secret/global/env_vars",
"secret/global/prod/env_vars",
"secret/products/bar/env_vars",
"secret/apps/foo/prod/env_vars",
"secret/services/foo/env_vars",
"secret/services/foo/prod/env_vars",
}, c.VaultPaths())

c.Environment = "dev"
assert.Equal(t, []string{
"secret/global/dev/env_vars",
"secret/products/bar/dev/env_vars",
"secret/apps/foo/dev/env_vars",
"secret/services/foo/dev/env_vars",
}, c.VaultPaths())
}
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func main() {

cfg := Config{
Service: os.Getenv("SERVICE_NAME"),
Product: os.Getenv("SERVICE_PRODUCT"),
Environment: os.Getenv("SERVICE_ENV"),
Region: os.Getenv("AWS_REGION"),
}
Expand All @@ -35,7 +34,6 @@ func main() {
logger := log.With().
Str("env", cfg.Environment).
Str("service", cfg.Service).
Str("product", cfg.Product).
Str("region", cfg.Region).
Logger()

Expand Down