From 4a71d685da05d31ba0f3d749dcdc61fe5835d4aa Mon Sep 17 00:00:00 2001 From: Erik Winter Date: Sat, 21 Dec 2024 14:01:58 +0100 Subject: [PATCH] debug --- Makefile | 3 +++ plan/main.go | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2f9c7ef..ea7ba3d 100644 --- a/Makefile +++ b/Makefile @@ -4,5 +4,8 @@ plan-deploy: sync-run: cd sync/service && go run . -dbname localhost -dbport 5432 -dbname planner -dbuser test -dbpassword test -port 8092 -key testKey +sync-debug: + cd sync/service && dlv debug . -- -dbname localhost -dbport 5432 -dbname planner -dbuser test -dbpassword test -port 8092 -key testKey + database: docker run -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -e POSTGRES_DB=planner -p 5432:5432 postgres:16 diff --git a/plan/main.go b/plan/main.go index 9dab701..9f94df2 100644 --- a/plan/main.go +++ b/plan/main.go @@ -12,12 +12,16 @@ import ( ) func main() { - confPath, err := os.UserConfigDir() - if err != nil { - fmt.Printf("could not get config path: %s\n", err) - os.Exit(1) + confPath := os.Getenv("PLAN_CONFIG_PATH") + if confPath == "" { + userConfigDir, err := os.UserConfigDir() + if err != nil { + fmt.Printf("could not get config path: %s\n", err) + os.Exit(1) + } + confPath = filepath.Join(userConfigDir, "planner", "plan", "config.yaml") } - conf, err := LoadConfig(filepath.Join(confPath, "planner", "plan", "config.yaml")) + conf, err := LoadConfig(confPath) if err != nil { fmt.Printf("could not open config file: %s\n", err) os.Exit(1)