File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,30 @@ update_config() {
69
69
echo " Updating configuration with environment variables"
70
70
local config_file=" ${WORK_DIR} /agent.config"
71
71
72
- # Update server URL
73
- sed -i.bak " s|com.lightrun.server=.*|com.lightrun.server=https://${LIGHTRUN_SERVER} |" " ${config_file} " && rm " ${config_file} .bak"
74
-
75
- # Update secret key
76
- sed -i.bak " s|com.lightrun.secret=.*|com.lightrun.secret=${LIGHTRUN_KEY} |" " ${config_file} " && rm " ${config_file} .bak"
77
-
78
- # Update pinned certificates
79
- sed -i.bak " s|pinned_certs=.*|pinned_certs=${PINNED_CERT} |" " ${config_file} " && rm " ${config_file} .bak"
72
+ if sed -n " s|com.lightrun.server=.*|com.lightrun.server=https://${LIGHTRUN_SERVER} |p" " ${config_file} " | grep -q . ; then
73
+ # Perform actual in-place change
74
+ sed -i " s|com.lightrun.server=.*|com.lightrun.server=https://${LIGHTRUN_SERVER} |" " ${config_file} "
75
+ exit 0
76
+ else
77
+ echo " No match found"
78
+ exit 1
79
+ fi
80
+ if sed -n " s|com.lightrun.secret=.*|com.lightrun.secret=${LIGHTRUN_KEY} |p" " ${config_file} " | grep -q . ; then
81
+ # Perform actual in-place change
82
+ sed -i " s|com.lightrun.secret=.*|com.lightrun.secret=${LIGHTRUN_KEY} |" " ${config_file} "
83
+ exit 0
84
+ else
85
+ echo " No match found"
86
+ exit 1
87
+ fi
88
+ if sed -n " s|pinned_certs=.*|pinned_certs=${PINNED_CERT} |p" " ${config_file} " | grep -q . ; then
89
+ # Perform actual in-place change
90
+ sed -i " s|pinned_certs=.*|pinned_certs=${PINNED_CERT} |" " ${config_file} "
91
+ exit 0
92
+ else
93
+ echo " No match found"
94
+ exit 1
95
+ fi
80
96
}
81
97
82
98
# Function to copy final configuration
You can’t perform that action at this time.
0 commit comments