From 649c5e259284a87a9271042400a76082ca77405d Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Fri, 12 Apr 2024 20:23:04 +0200 Subject: [PATCH] fix(kb/make): conditionally import a file deending on the target's name --- knowledge base/gnu userland/make.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/knowledge base/gnu userland/make.md b/knowledge base/gnu userland/make.md index c5710cd..0c4e8b5 100644 --- a/knowledge base/gnu userland/make.md +++ b/knowledge base/gnu userland/make.md @@ -83,6 +83,14 @@ plan: pre-flight ${tf_vars_file} apply: plan ${tf_plan_file} ${info applying ${environment_id}'s plan} @terraform apply '${tf_plan_file}' + +ifeq "test-db-connection" "$(findstring test-db-connection,$(MAKECMDGOALS))" +-include db.env db.secret.env +endif +test-db-connection: override PSQL ?= psql +test-db-connection: override PGPASSWORD ?= ${password} +test-db-connection: ${shell which 'psql'} + @${PSQL} -h '${host}' -p '${port}' -U '${username}' '${database}' -c '\q' ``` ## Load .env files in the Makefile