Compare commits

...

2 Commits

Author SHA1 Message Date
Urko 4877f72f04 feat: config small fix 2023-02-26 22:10:07 +01:00
Urko 60b40c84f3 feat: upgrade makefile 2023-02-26 22:09:51 +01:00
2 changed files with 5 additions and 6 deletions

View File

@ -13,8 +13,7 @@ test-coverage:
mkdir ${COVERAGE_DIR}
go test -v -coverprofile ${COVERAGE_DIR}/cover.out ./...
go tool cover -html ${COVERAGE_DIR}/cover.out -o ${COVERAGE_DIR}/cover.html
cd ${COVERAGE_DIR}
open cover.html
build:
rm -rf ${BINARY_DIR}
mkdir ${BINARY_DIR}
go build -o ${BINARY_DIR}/${BINARY_NAME}
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o ./${BINARY_DIR}/${BINARY_NAME} main.go

View File

@ -13,10 +13,10 @@ type Config struct {
ScriptBinaryPath string `required:"true" split_words:"true"`
WebhookScriptPath string `required:"true" split_words:"true"`
FileToWatchPath string `required:"true" split_words:"true"`
TestFileToWatchPath string `required:"true" split_words:"true"`
TestFileToWatchPath string `required:"false" split_words:"true"`
}
func rootDir() string {
func RootDir() string {
cmdOut, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
if err != nil {
log.Fatalf("exec.Command: %s", err)
@ -29,7 +29,7 @@ func rootDir() string {
func NewConfig(isProd bool) *Config {
if !isProd {
err := godotenv.Load(rootDir() + "/.env")
err := godotenv.Load(RootDir() + "/.env")
if err != nil {
log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n")
}