Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master, main ]

permissions:
checks: write

jobs:
set-version:
runs-on: ubuntu-latest
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Config Manager

[![Go Reference](https://pkg.go.dev/badge/github.com/dnitsch/configmanager.svg)](https://pkg.go.dev/github.com/dnitsch/configmanager)
[![Go Report Card](https://goreportcard.com/badge/github.com/dnitsch/configmanager)](https://goreportcard.com/report/github.com/dnitsch/configmanager)
[![Go Reference](https://pkg.go.dev/badge/github.com/DevLabFoundry/configmanager.svg)](https://pkg.go.dev/github.com/DevLabFoundry/configmanager)
[![Go Report Card](https://goreportcard.com/badge/github.com/DevLabFoundry/configmanager)](https://goreportcard.com/report/github.com/DevLabFoundry/configmanager)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dnitsch_configmanager&metric=bugs)](https://sonarcloud.io/summary/new_code?id=dnitsch_configmanager)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=dnitsch_configmanager&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=dnitsch_configmanager)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=dnitsch_configmanager&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=dnitsch_configmanager)
Expand All @@ -11,7 +11,7 @@
Package used for retrieving application settings from various sources.

Currently supported variable and secrets implementations:
<!--
<!--
"AWSSECRETS"
// AWS Parameter Store prefix
ParamStorePrefix ImplementationPrefix = "AWSPARAMSTR"
Expand Down Expand Up @@ -43,7 +43,7 @@ Currently supported variable and secrets implementations:

The main driver is to use component level configuration objects, if stored in a `"namespaced"` manner e.g. in AWS ParamStore as `/nonprod/component-service-a/configVar`, however this is not a requirement and the param name can be whatever. Though whilst using some sort of a organised manner it will be more straight forward to allow other services to consume certain secrets/params based on resource/access policies.

> Beware size limitation with certain config/vault implementations. In which case it's best to split certain items up e.g. TLS certs `/nonprod/component-service-a/pub-cert`, `/nonprod/component-service-a/private-cert`, `/nonprod/component-service-a/chain1-cert`, etc...
> Beware size limitation with certain config/vault implementations. In which case it's best to split certain items up e.g. TLS certs `/nonprod/component-service-a/pub-cert`, `/nonprod/component-service-a/private-cert`, `/nonprod/component-service-a/chain1-cert`, etc...

Where `configVar` can be either a parseable string `'som3#!S$CRet'` or a number `3306` or a parseable single level JSON object like `{host: ..., pass: ...., port: ...}` which can be returned whole or accessed via a key separator for a specific value.

Expand Down Expand Up @@ -92,7 +92,7 @@ _An example token would look like this_

The `AWSSECRETS` the strategy identifier to choose the correct provider at runtime. Multiple providers can be referenced in a single run via a CLI or with the API.

This is not overrideable and must be exactly as it is in the provided list of providers.
This is not overrideable and must be exactly as it is in the provided list of providers.

### __Token Separator__

Expand All @@ -106,7 +106,7 @@ cnf := generator.NewConfig().WithTokenSeparator("://")

### __Provider Secret/Config Path__

The `/path/to/my/key` part from the [example token](#awssecretspathtomykeylookupinsideobjectmetadata) is the actual path to the item in the backing store.
The `/path/to/my/key` part from the [example token](#awssecretspathtomykeylookupinsideobjectmetadata) is the actual path to the item in the backing store.

See the different special considerations per provider as it different providers will require different implementations.

Expand All @@ -116,7 +116,7 @@ __THIS IS OPTIONAL__

The `|` symbol from the [example token](#awssecretspathtomykeylookupinsideobjectmetadata) is used to specify the key seperator.

If an item retrieved from a store is JSON parseable map it can be interrogated for further properties inside.
If an item retrieved from a store is JSON parseable map it can be interrogated for further properties inside.

### __Look up key__

Expand Down Expand Up @@ -154,7 +154,7 @@ See [examples of working with files](docs/examples.md#working-with-files) for mo

### Token Metadata Config

The `[meta=data]` from the [example token](#awssecretspathtomykeylookupinsideobjectmetadata) - is the optional metadata about the target in the backing provider
The `[meta=data]` from the [example token](#awssecretspathtomykeylookupinsideobjectmetadata) - is the optional metadata about the target in the backing provider

IT must have this format `[key=value]` - IT IS OPTIONAL

Expand Down Expand Up @@ -199,7 +199,7 @@ The token itself must contain all of the following properties, so that it would

- Storage account name [`STORAGE_ACCOUNT_NAME`]
- Table Name [`TABLE_NAME`]
- > It might make sense to make this table global to the domain or project
- > It might make sense to make this table global to the domain or project
- Partition Key [`PARTITION_KEY`]
- > This could correspond to the component/service name
- Row Key [`ROW_KEY`]
Expand Down Expand Up @@ -230,7 +230,7 @@ when using Vault in AWS - you can set the value of the `VAULT_TOKEN=aws_iam` thi

The Hashicorp Vault functions in the same exact way as the other implementations. It will retrieve the JSON object and can be looked up within it by using a key separator.

## [Go API](https://pkg.go.dev/github.com/dnitsch/configmanager)
## [Go API](https://pkg.go.dev/github.com/DevLabFoundry/configmanager)

## [Examples](docs/examples.md)

Expand Down
10 changes: 5 additions & 5 deletions cmd/configmanager/configmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"io"

"github.com/dnitsch/configmanager"
"github.com/dnitsch/configmanager/internal/cmdutils"
"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/dnitsch/configmanager/pkg/log"
"github.com/DevLabFoundry/configmanager"
"github.com/DevLabFoundry/configmanager/internal/cmdutils"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/configmanager/configmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

cmd "github.com/dnitsch/configmanager/cmd/configmanager"
"github.com/dnitsch/configmanager/pkg/log"
cmd "github.com/DevLabFoundry/configmanager/cmd/configmanager"
"github.com/DevLabFoundry/configmanager/pkg/log"
)

type cmdTestInput struct {
Expand Down
12 changes: 6 additions & 6 deletions cmd/configmanager/fromfileinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"fmt"

"github.com/dnitsch/configmanager/internal/cmdutils"
"github.com/DevLabFoundry/configmanager/internal/cmdutils"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -42,13 +42,13 @@ func newFromStrCmd(rootCmd *Root) {
},
}

fromstrCmd.PersistentFlags().StringVarP(&f.input, "input", "i", "", `Path to file which contents will be read in or the contents of a string
inside a variable to be searched for tokens.
If value is a valid path it will open it if not it will accept the string as an input.
fromstrCmd.PersistentFlags().StringVarP(&f.input, "input", "i", "", `Path to file which contents will be read in or the contents of a string
inside a variable to be searched for tokens.
If value is a valid path it will open it if not it will accept the string as an input.
e.g. -i /some/file or -i $"(cat /som/file)", are both valid input values`)
fromstrCmd.MarkPersistentFlagRequired("input")
fromstrCmd.PersistentFlags().StringVarP(&f.path, "path", "p", "./app.env", `Path where to write out the
replaced a config/secret variables. Special value of stdout can be used to return the output to stdout e.g. -p stdout,
fromstrCmd.PersistentFlags().StringVarP(&f.path, "path", "p", "./app.env", `Path where to write out the
replaced a config/secret variables. Special value of stdout can be used to return the output to stdout e.g. -p stdout,
unix style output only`)
rootCmd.Cmd.AddCommand(fromstrCmd)
}
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"os"

cfgmgr "github.com/dnitsch/configmanager/cmd/configmanager"
"github.com/dnitsch/configmanager/pkg/log"
cfgmgr "github.com/DevLabFoundry/configmanager/cmd/configmanager"
"github.com/DevLabFoundry/configmanager/pkg/log"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions configmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"slices"
"strings"

"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/pkg/generator"
"gopkg.in/yaml.v3"
)

Expand Down
22 changes: 11 additions & 11 deletions configmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"sort"
"testing"

"github.com/dnitsch/configmanager"
"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/internal/testutils"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/internal/testutils"
"github.com/DevLabFoundry/configmanager/pkg/generator"
"github.com/go-test/deep"
)

Expand Down Expand Up @@ -94,13 +94,13 @@ space: preserved
input: `
// TOML
[[somestuff]]
key = "FOO#/test"
key = "FOO#/test"
`,
genvar: &mockGenerator{},
expect: `
// TOML
[[somestuff]]
key = "val1"
key = "val1"
`,
},
"strTomlWithoutQuotes": {
Expand Down Expand Up @@ -301,7 +301,7 @@ func Test_YamlRetrieveUnmarshalled(t *testing.T) {
"happy path complex struct complete": {
input: []byte(`foo: AWSSECRETS:///bar/foo
bar: quz
lol:
lol:
bla: booo
another:
number: 1235
Expand Down Expand Up @@ -424,18 +424,18 @@ func TestFindTokens(t *testing.T) {
}{
"extract from text correctly": {
`Where does it come from?
Contrary to popular belief,
Contrary to popular belief,
Lorem Ipsum is AWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj <= in middle of sentencenot simply random text.
It has roots in a piece of classical Latin literature from 45
It has roots in a piece of classical Latin literature from 45
BC, making it over 2000 years old. Richard McClintock, a Latin professor at
Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, c
onsectetur, from a Lorem Ipsum passage , at the end of line => AWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj
and going through the cites of the word in c
lassical literature, discovered the undoubtable source. Lorem Ipsum comes from secti
ons in singles =>'AWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj'1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil)
in doubles => "AWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj"
by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular
during the :=> embedded in text RenaissanceAWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj[] embedded in text <=:
by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular
during the :=> embedded in text RenaissanceAWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj[] embedded in text <=:
The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.`,
[]string{
"AWSPARAMSTR:///djsfsdkjvfjkhfdvibdfinjdsfnjvdsflj",
Expand Down
14 changes: 7 additions & 7 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples
# Examples

<!--
<!--
```go
rawStr := `somePAss: AWSPARAMSTR:///int-test/pocketbase/admin-pwd`
cm := configmanager.ConfigManager{}
Expand Down Expand Up @@ -84,8 +84,8 @@ import (
"context"
"fmt"

"github.com/dnitsch/configmanager/pkg/generator"
"github.com/dnitsch/configmanager"
"github.com/DevLabFoundry/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager"
)

func main() {
Expand Down Expand Up @@ -128,8 +128,8 @@ import (
"log"
"os"

"github.com/dnitsch/configmanager"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager"
"github.com/DevLabFoundry/configmanager/pkg/generator"
)

var (
Expand Down Expand Up @@ -163,4 +163,4 @@ func credentialString(ctx context.Context, pwdToken, hostToken string) (string,

return "", fmt.Errorf("unable to find value via token")
}
```
```
8 changes: 4 additions & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Installation

Major platform binaries [here](https://github.com/dnitsch/configmanager/releases)
Major platform binaries [here](https://github.com/DevLabFoundry/configmanager/releases)

*nix binary

```bash
curl -L https://github.com/dnitsch/configmanager/releases/latest/download/configmanager-linux -o configmanager
curl -L https://github.com/DevLabFoundry/configmanager/releases/latest/download/configmanager-linux -o configmanager
```

MacOS binary

```bash
curl -L https://github.com/dnitsch/configmanager/releases/latest/download/configmanager-darwin -o configmanager
curl -L https://github.com/DevLabFoundry/configmanager/releases/latest/download/configmanager-darwin -o configmanager
```

```bash
Expand All @@ -22,5 +22,5 @@ sudo mv configmanager /usr/local/bin
Download specific version:

```bash
curl -L https://github.com/dnitsch/configmanager/releases/download/v0.5.0/configmanager-`uname -s` -o configmanager
curl -L https://github.com/DevLabFoundry/configmanager/releases/download/v0.5.0/configmanager-`uname -s` -o configmanager
```
2 changes: 1 addition & 1 deletion examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"fmt"

"github.com/dnitsch/configmanager"
"github.com/DevLabFoundry/configmanager"
)

const DO_STUFF_WITH_VALS_HERE = "connstring:user@%v:host=%s/someschema..."
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/dnitsch/configmanager
module github.com/DevLabFoundry/configmanager

go 1.23.2

Expand Down
6 changes: 3 additions & 3 deletions internal/cmdutils/cmdutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"os"
"strings"

"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/dnitsch/configmanager/pkg/log"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/cmdutils/cmdutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"strings"
"testing"

"github.com/dnitsch/configmanager/internal/cmdutils"
"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/internal/testutils"
"github.com/dnitsch/configmanager/pkg/generator"
log "github.com/dnitsch/configmanager/pkg/log"
"github.com/DevLabFoundry/configmanager/internal/cmdutils"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/internal/testutils"
"github.com/DevLabFoundry/configmanager/pkg/generator"
log "github.com/DevLabFoundry/configmanager/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/cmdutils/postprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io"
"strings"

"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/pkg/generator"
)

// PostProcessor
Expand Down
8 changes: 4 additions & 4 deletions internal/cmdutils/postprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"strings"
"testing"

"github.com/dnitsch/configmanager/internal/cmdutils"
"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/internal/testutils"
"github.com/dnitsch/configmanager/pkg/generator"
"github.com/DevLabFoundry/configmanager/internal/cmdutils"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/internal/testutils"
"github.com/DevLabFoundry/configmanager/pkg/generator"
)

func postprocessorHelper(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package config_test
import (
"testing"

"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/internal/testutils"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/internal/testutils"
)

func Test_SelfName(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/store/azappconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
"github.com/dnitsch/configmanager/internal/config"
"github.com/dnitsch/configmanager/pkg/log"
"github.com/DevLabFoundry/configmanager/internal/config"
"github.com/DevLabFoundry/configmanager/pkg/log"
)

// appConfApi
Expand Down
Loading