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(config): #13 - config handling using koanf package #12

Merged
merged 9 commits into from
Nov 28, 2023

Conversation

DOO-DEV
Copy link
Contributor

@DOO-DEV DOO-DEV commented Nov 21, 2023

No description provided.

@DOO-DEV DOO-DEV closed this Nov 21, 2023
@DOO-DEV DOO-DEV reopened this Nov 21, 2023
Copy link
Contributor

@gohossein gohossein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test command to Makefile.
Add Github Action to run make test command in pull request and main branch.

@@ -0,0 +1,135 @@
package config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change config to config_test.
All test files should have _test postfix in the package name.

Copy link
Contributor

@gohossein gohossein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ormus scope to PR title
feat(ormus): config....

@DOO-DEV DOO-DEV changed the title feat: config handling using koanf package feat(ormus): config handling using koanf package Nov 22, 2023
Copy link
Contributor

@gohossein gohossein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, just a few things need to be fixed.

Makefile Outdated
golangci-lint run --config=$(ROOT)/.golangci.yml $(ROOT)/...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to define ROOT variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root is already defined

Makefile Outdated
@@ -8,4 +8,7 @@ ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
// TODO: add lint and format to github ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add format command and remove TODO comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the format command add to the #16 pull request

Makefile Outdated

test:
go test -v ./...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the indentation with 4 spaces is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use one tab and its 4 space. in the main branch that you write it its the same spacing

image

@gohossein
Copy link
Contributor

Please rebase with main branch and resovle the conflicts.

@gohossein
Copy link
Contributor

Please add issue number to PR title like these PR.

@DOO-DEV DOO-DEV changed the title feat(ormus): config handling using koanf package feat(issue #13): config handling using koanf package Nov 24, 2023
@DOO-DEV DOO-DEV changed the title feat(issue #13): config handling using koanf package feat(config): #13 - config handling using koanf package Nov 24, 2023
Copy link
Contributor

@gohossein gohossein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very close to Approve :)

config/loader.go Outdated
"github.com/knadh/koanf"
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/env"
"github.com/knadh/koanf/providers/file"
"github.com/knadh/koanf/providers/structs"
"log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort import packages using goimports, see this.

config/loader.go Outdated
log.Fatalf("error unmarshaling config: %s", err)
}
}

func C() *Config {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not expose Config with pointer. The caller can modify the config object, just return Config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

config/loader.go Outdated
return c
}

func New(opt Option) *Config {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return Config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@gohossein gohossein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@@ -0,0 +1,5 @@
package config

func Default() Config {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant

event/context.go Outdated
@@ -5,7 +5,7 @@ import (
"net/url"
)

// This is an implementation of Context class similar to the `CoreExtraContext` in segment js SDK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra changes.
rebase the main and resolve the conflicts

@gohossein
Copy link
Contributor

Please squash commits and rebase it with main

@gocastsian gocastsian merged commit 5e50685 into ormushq:main Nov 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementing Config Handling for Enhanced Project Configuration Management
3 participants