-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds db client layer * updates oapi spec * updates readme commands * adds golang-ci linter config --------- Signed-off-by: Amit Singh <[email protected]>
- Loading branch information
Showing
16 changed files
with
222 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
name: Tests | ||
|
||
on: | ||
push: | ||
|
@@ -10,8 +10,7 @@ on: | |
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build: | ||
lint_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -24,5 +23,8 @@ jobs: | |
- name: Golangci-lint | ||
uses: golangci/[email protected] | ||
|
||
- name: Test | ||
run: make acceptance-test | ||
- name: Unit Tests | ||
run: make unit-tests | ||
|
||
- name: Acceptance Tests | ||
run: make acceptance-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
issues: | ||
exclude: | ||
- (.*)_test\.go$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package conf | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/ilyakaznacheev/cleanenv" | ||
) | ||
|
||
type conf struct { | ||
PgUserPassword string `env:"PG_USER_PASSWORD" yaml:"PG_USER_PASSWORD" env-required:"true"` | ||
PgServer string `env:"PG_SERVER" yaml:"PG_SERVER" env-required:"true"` | ||
} | ||
|
||
var Cfg conf | ||
|
||
func LoadConfig() { | ||
if envPath, ok := os.LookupEnv("DOTENV_PATH"); ok { | ||
file, err := os.Open(envPath) | ||
if err != nil { | ||
log.Fatalf("error while reading dotenv file: %s :: %s", envPath, err) | ||
} | ||
|
||
err = cleanenv.ParseYAML(file, &Cfg) | ||
if err != nil { | ||
log.Fatalf("error while parsing dotenv file: %s :: %s", envPath, err) | ||
} | ||
} else { | ||
err := cleanenv.ReadEnv(&Cfg) | ||
if err != nil { | ||
log.Fatalf("error while reading config environment variables :: %s", err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PG_USER_PASSWORD: env-pwd | ||
PG_SERVER: env-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package conf_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestConf(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Conf Test Suite") | ||
} |
Oops, something went wrong.