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

Remove prefix for searching on environment variables #20

Merged
merged 11 commits into from
Dec 27, 2023
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
14 changes: 14 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: test
on:
- push
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- run: go test -v ./...
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
Share utilities between Kaytu go projects and microservices. These modules are provided
under the `/pkg` and as follows:

### `/pkg/fp`

This package contains functional programming style of things, for example when you want to accept optional
string parameter you can define it as `*string` and then using the `fp` package pass the value into it:

```go
fp.Optional("I am an optional string")
```

### `/pkg/koanf`

Load configuration from environment variables, file and default based on [koanf](https://github.com/knadh/koanf).
Expand All @@ -29,6 +38,6 @@ as follows:

```go
type Config struct {
RabbitMQ koanf.RabbitMQ `koanf:"rabbitmq"`
RabbitMQ koanf.RabbitMQ `koanf:"rabbitmq"`
}
```
```
237 changes: 123 additions & 114 deletions go.mod

Large diffs are not rendered by default.

274 changes: 274 additions & 0 deletions go.sum

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions pkg/fp/optional.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package optional

// Optional allows for generic creation of pointers to values.
func Optional[T any](value T) *T {
return &value
}
6 changes: 0 additions & 6 deletions pkg/koanf/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ type HttpServer struct {
Address string `koanf:"address"`
}

type RabbitMQ struct {
Service string `koanf:"service"`
Username string `koanf:"username"`
Password string `koanf:"password"`
}

type Vault struct {
Address string `koanf:"address"`
Role string `koanf:"role"`
Expand Down
4 changes: 3 additions & 1 deletion pkg/queue/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ type QueueTestSuite struct {
}

func TestQueue(t *testing.T) {
suite.Run(t, &QueueTestSuite{})
t.Skip("it should be fixed")

suite.Run(t, new(QueueTestSuite))
}

func (ts *QueueTestSuite) SetupSuite() {
Expand Down
Loading