File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -199,4 +199,19 @@ public static function docker_compose_down( $dir ) {
199199 return false ;
200200 }
201201
202+ /**
203+ * Check if a particular service exists in given docker-compose.yml.
204+ *
205+ * @param string $service Service whose availability needs to be checked.
206+ * @param string $site_fs_path Path to the site root where docker-compose.yml file is present.
207+ *
208+ * @return bool Whether service is available or not.
209+ */
210+ public static function service_exists ( $ service , $ site_fs_path ) {
211+ chdir ( $ site_fs_path );
212+ $ launch = EE ::launch ( 'docker-compose config --services ' );
213+ $ services = explode ( PHP_EOL , trim ( $ launch ->stdout ) );
214+
215+ return in_array ( $ service , $ services , true );
216+ }
202217}
You can’t perform that action at this time.
0 commit comments