Skip to content

Commit

Permalink
Merge pull request #143 from articulate/feature/remove-deprecated-paths
Browse files Browse the repository at this point in the history
feat!: don't load products and apps paths
  • Loading branch information
mloberg authored Oct 12, 2023
2 parents 660f1aa + e8b4b44 commit f46778b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
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

0 comments on commit f46778b

Please sign in to comment.