Improve build and error handling

This commit is contained in:
Jan Eitzinger 2023-05-11 09:39:23 +02:00
parent 538427d59b
commit cc634dd155
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,6 @@
TARGET = ./cc-backend
VAR = ./var
CFG = config.json .env
FRONTEND = ./web/frontend
VERSION = 1
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
@ -31,7 +32,7 @@ SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \
.NOTPARALLEL:
$(TARGET): $(VAR) $(SVELTE_TARGETS)
$(TARGET): $(VAR) $(CFG) $(SVELTE_TARGETS)
$(info ===> BUILD cc-backend)
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
@ -58,11 +59,18 @@ tags:
$(VAR):
@mkdir $(VAR)
cd web/frontend && npm install
config.json:
$(info ===> Initialize config.json file)
@cp configs/config.json config.json
.env:
$(info ===> Initialize .env file)
@cp configs/env-template.txt .env
$(SVELTE_TARGETS): $(SVELTE_SRC)
$(info ===> BUILD frontend)
cd web/frontend && npm run build
cd web/frontend && npm install && npm run build
install: $(TARGET)
@WORKSPACE=$(PREFIX)

View File

@ -24,7 +24,7 @@ import (
func LoadEnv(file string) error {
f, err := os.Open(file)
if err != nil {
log.Error("Error while opening file")
log.Error("Error while opening .env file")
return err
}