File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -134,17 +134,24 @@ public function checkDaemonConnection(array $daemonParams): Response {
134134 $ haproxyPassword = $ daemonParams ['deploy_config ' ]['haproxy_password ' ] ?? null ;
135135
136136 if ($ haproxyPassword === 'dummySecret123 ' ) {
137- // If the secret is "dummySecret123" we check if such record is present in DB
137+ // For cases when the password itself is 'dummySecret123'
138+ $ daemonParams ['deploy_config ' ]['haproxy_password ' ] = $ this ->crypto ->encrypt ($ haproxyPassword );
139+
140+ // Check if such record is present in the DB
138141 $ daemonConfig = $ this ->daemonConfigService ->getDaemonConfigByName ($ daemonParams ['name ' ]);
139142 if ($ daemonConfig !== null ) {
143+ // such Daemon config already present in the DB
140144 $ haproxyPasswordDB = $ daemonConfig ->getDeployConfig ()['haproxy_password ' ] ?? "" ;
141145 if ($ haproxyPasswordDB ) {
142- // if there is a record in the DB and there is a password,
143- // then we request it from the DB instead of the “masked” one
146+ // get password from the DB instead of the “masked” one
144147 $ daemonParams ['deploy_config ' ]['haproxy_password ' ] = $ haproxyPasswordDB ;
145148 }
146149 }
147150 }
151+ elseif (!empty ($ haproxyPassword )) {
152+ // New password provided, encrypt it, as "initGuzzleClient" expects to receive encrypted password
153+ $ daemonParams ['deploy_config ' ]['haproxy_password ' ] = $ this ->crypto ->encrypt ($ haproxyPassword );
154+ }
148155
149156 $ daemonConfig = new DaemonConfig ([
150157 'name ' => $ daemonParams ['name ' ],
You can’t perform that action at this time.
0 commit comments