speed up things

add DOCKER_MACHINE and DOCKER_SYSTEM to .env to avoid waisting time every call
This commit is contained in:
2025-01-03 11:50:55 +01:00
parent d07a6aafaf
commit bc8a68aaf8
6 changed files with 20 additions and 9 deletions
+5 -3
View File
@@ -74,10 +74,11 @@ endef
# create a new (empty if ENV_RESET is true) environment with env.args
# read environment variables and keep only those existing in .env.dist
# add .env overrides variables definition
# add .env.dist variables definition
# add .env.dist variables definition when variable value is not the variable name itself
# remove empty lines or comments
# remove duplicate variables
# replace variables in stdin with their value from the new environment
# eval and replace commands in stdin with their result
# remove residual empty lines or comments
# sort alphabetically
# add variables definition to the .env file
@@ -95,10 +96,11 @@ define .env_update
env $(env_reset) $(env.args) \
$$(env |awk -F '=' 'NR == FNR { if($$1 !~ /^(#|$$)/) { A[$$1]; next } } ($$1 in A)' $(env_dist) - \
|cat - $(env_over) \
|cat - $(env_dist) \
|cat - $(env_dist) |awk -F '=' '{ if(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH-3);if(var!=$$1) print} else print}' \
|sed -e /^$$/d -e /^#/d \
|awk -F '=' '!seen[$$1]++') \
awk '{while(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH-3);gsub("[$$]{"var"}",ENVIRON[var])} print}') \
awk '{while(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH-3);if("$${"var"}"!=ENVIRON[var]){gsub("[$$]{"var"}",ENVIRON[var])}else{gsub("[$$]{"var"}","")}}; \
while(match($$0,"[$$]\\([^\\)]*\\)")) {cmd=substr($$0,RSTART+2,RLENGTH-3);cmd|getline var;gsub("[$$]\\([^\\)]*\\)",var);close(cmd)} print}') \
|sed -e /^$$/d -e /^#/d \
|sort \
>> $(env_file) $(if $(VERBOSE)$(DEBUG),,2> /dev/null) ||:;