From b8e7361d5d301731776784760c3e08bfc444ed90 Mon Sep 17 00:00:00 2001 From: Navarr Date: Wed, 10 May 2023 16:47:53 -0400 Subject: [PATCH 01/10] As of Mutagen 0.15.0, It displays "Connected: Yes" for beta and alpha if they are connected I have not been able to identify where "Connected state: Connected" used to be as of yet, but I'm making the assumption it changed to "Connected:" when it first appears in list_monitor_common.go, which is v0.15.0. Prior to this commit, Warden would always run `warden sync start` after `warden env up` - which for larger projects on machines with Antivirus is.. incredibly annoying. --- commands/env.cmd | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/commands/env.cmd b/commands/env.cmd index b5f67a38..570e9e55 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -201,18 +201,24 @@ if ([[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ] && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] \ && [[ $($WARDEN_BIN sync list | grep -i 'Status: \[Paused\]' | wc -l | awk '{print $1}') == "1" ]] \ && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ - && [[ $(docker container inspect $($WARDEN_BIN env ps -q php-fpm) --format '{{ .State.Status }}') = "running" ]] \ + && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] \ && [[ $($WARDEN_BIN env ps -q php-fpm) = $($WARDEN_BIN sync list | grep -i 'URL: docker' | awk -F'/' '{print $3}') ]] then $WARDEN_BIN sync resume fi +MUTAGEN_VERSION=$(mutagen version) +CONNECTION_STATE_STRING='Connected state: Connected' +if [[ $(version "${MUTAGEN_VERSION}") -ge $(version '0.15.0') ]]; then + CONNECTION_STATE_STRING='Connected: Yes' +fi + ## start mutagen sync if needed if ([[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]) \ && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] \ - && [[ $($WARDEN_BIN sync list | grep -i 'Connection state: Connected' | wc -l | awk '{print $1}') != "2" ]] \ + && [[ $($WARDEN_BIN sync list | grep -c "${CONNECTION_STATE_STRING}" | awk '{print $1}') != "2" ]] \ && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ - && [[ $(docker container inspect $($WARDEN_BIN env ps -q php-fpm) --format '{{ .State.Status }}') = "running" ]] + && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] then $WARDEN_BIN sync start fi From 63cd65dad8a3f212a5044792f66b36a696e37e79 Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Mon, 19 Jun 2023 11:31:44 -0400 Subject: [PATCH 02/10] Add 0.14.0 Changelog --- CHANGELOG.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33e01811..05c90d7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,19 @@ # Change Log + +## Version [0.14.0](https://github.com/wardenenv/warden/tree/0.14.0) (2023-06-19) +[All Commits](https://github.com/wardenenv/warden/compare/0.13.1..0.14.0) **Dependency Changes:** * All commands now use the Docker Compose plugin (`docker compose`) instead of the standalone command (`docker-compose`) - Please be aware that this will change your container names from using underscores to using dashes (e.g. vanilla_db_1 becomes vanilla-db-1). + Please be aware that this will change your container names from using underscores to using dashes (e.g. vanilla_db_1 becomes vanilla-db-1). This is configured through the environment variable `DOCKER_COMPOSE_COMMAND` which defaults to `docker compose`. **Enhancements** -* ElasticSearch 8.7 images are available +* ElasticSearch 8.7 and 8.8 images are available +* Drupal environment type added ([#646](https://github.com/wardenenv/warden/pull/646) by @bap14) ## Version [0.13.1](https://github.com/wardenenv/warden/tree/0.13.1) (2023-03-21) [All Commits](https://github.com/wardenenv/warden/compare/0.13.0..0.13.1) From 36a1df26076f48a669dc69b65142eb3d2a81e08f Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Mon, 3 Jul 2023 09:49:35 -0400 Subject: [PATCH 03/10] Add Sponsors and "where to contribute" --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index acde10e9..66fcab7f 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,13 @@ All contributions to the Warden project are welcome: use-cases, documentation, c Please note that by submitting a pull request or otherwise contributing to the Warden project, you warrant that each of your contributions is an original work and that you have full authority to grant rights to said contribution and by so doing you grant the owners of the Warden project, and those who receive the contribution directly or indirectly, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license to make, have made, use, offer to sell, sell and import or otherwise dispose of the contributions alone or with the Warden project in it's entirety. +## Where to Contribute + +* [warden](https://github.com/wardenenv/warden) - `warden` commands and docker-compose files +* [images](https://github.com/wardenenv/images) - Docker images to be used by the docker-compose files +* [docs](https://github.com/wardenenv/docs) - Documentation (docs.warden.dev) +* [homebrew-warden](https://github.com/wardenenv/homebrew-warden) - Mac's Homebrew installation instructions and requirements + ## License This work is licensed under the MIT license. See [LICENSE](https://github.com/davidalger/warden/blob/develop/LICENSE) file for details. @@ -33,3 +40,10 @@ This work is licensed under the MIT license. See [LICENSE](https://github.com/da ## Author Information This project was started in 2019 by [David Alger](https://davidalger.com/). + +# Gold Sponsors +[![SwiftOtter](https://warden.dev/img/sponsors/swiftotter.svg)](https://www.swiftotter.com/) +[![Sansec.io](https://warden.dev/img/sponsors/sansec.svg)](https://www.sansec.io/) +[![Hyvä](https://user-images.githubusercontent.com/145128/226427529-53483968-c9ab-484a-9ae3-c6abb58f81c9.png)](https://www.hyva.io/) + +Support Warden Development on OpenCollective or Github Sponsors From f58018f4ad71dda8dfbd6e4666eba7722ced4bb1 Mon Sep 17 00:00:00 2001 From: Brett Patterson Date: Wed, 5 Jul 2023 09:07:53 -0400 Subject: [PATCH 04/10] Rework status command to show projects even if Warden core services aren't running --- commands/status.cmd | 53 ++++++++++++++++++++++++++++++++++++++++++++ commands/status.help | 4 ++++ commands/usage.help | 1 + 3 files changed, 58 insertions(+) create mode 100644 commands/status.cmd create mode 100644 commands/status.help diff --git a/commands/status.cmd b/commands/status.cmd new file mode 100644 index 00000000..1d273bb5 --- /dev/null +++ b/commands/status.cmd @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 + +assertDockerRunning + +wardenNetworkName=$(cat ${WARDEN_DIR}/docker/docker-compose.yml | grep -A3 'networks:' | tail -n1 | sed -e 's/[[:blank:]]*name:[[:blank:]]*//g') +wardenNetworkId=$(docker network ls -q --filter name="${wardenNetworkName}") + +if [[ -z "${wardenNetworkId}" ]]; then + echo -e "[\033[33;1m!!\033[0m] \033[31mWarden is not currently running.\033[0m Run \033[36mwarden svc up\033[0m to start Warden core services." +fi + +OLDIFS="$IFS"; +IFS=$'\n' +projectNetworkList=( $(docker network ls --format '{{.Name}}' -q --filter "label=dev.warden.environment.name") ) +IFS="$OLDIFS" + +messageList=() +for projectNetwork in "${projectNetworkList[@]}"; do + [[ -z "${projectNetwork}" || "${projectNetwork}" == "${wardenNetworkName}" ]] && continue # Skip empty project network names (if any) + + prefix="${projectNetwork%_default}" + prefixLen="${#prefix}" + ((prefixLen+=1)) + projectContainers=$(docker network inspect --format '{{ range $k,$v := .Containers }}{{ $nameLen := len $v.Name }}{{ if gt $nameLen '"${prefixLen}"' }}{{ $prefix := slice $v.Name 0 '"${prefixLen}"' }}{{ if eq $prefix "'"${prefix}-"'" }}{{ println $v.Name }}{{end}}{{end}}{{end}}' "${projectNetwork}") + container=$(echo "$projectContainers" | head -n1) + + [[ -z "${container}" ]] && continue # Project is not running, skip it + + projectDir=$(docker container inspect --format '{{ index .Config.Labels "com.docker.compose.project.working_dir"}}' "$container") + projectName=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_NAME=' | sed -e 's/WARDEN_ENV_NAME=[[:space:]]*//g' | tr -d -) + projectType=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_TYPE=' | sed -e 's/WARDEN_ENV_TYPE=[[:space:]]*//g' | tr -d -) + traefikDomain=$(cat "${projectDir}/.env" | grep '^TRAEFIK_DOMAIN=' | sed -e 's/TRAEFIK_DOMAIN=[[:space:]]*//g' | tr -d -) + + messageList+=(" \033[1;35m${projectName}\033[0m a \033[36m${projectType}\033[0m project") + messageList+=(" Project Directory: \033[33m${projectDir}\033[0m") + messageList+=(" Project URL: \033[94mhttps://${traefikDomain}\033[0m") + + [[ "$projectNetwork" != "${projectNetworkList[@]: -1:1}" ]] && messageList+=() +done + +if [[ "${#messageList[@]}" > 0 ]]; then + if [[ -z "${wardenNetworkId}" ]]; then + echo -e "Found the following \033[32mrunning\033[0m projects; however, \033[31mWarden core services are currently not running\033[0m:" + else + echo -e "Found the following \033[32mrunning\033[0m environments:" + fi + for line in "${messageList[@]}"; do + echo -e "$line" + done +else + echo "No running environments found." +fi diff --git a/commands/status.help b/commands/status.help new file mode 100644 index 00000000..5c1c2002 --- /dev/null +++ b/commands/status.help @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 + +WARDEN_USAGE="Provides listing of projects that are currently running that Warden has been used to start" \ No newline at end of file diff --git a/commands/usage.help b/commands/usage.help index 8259ff22..69fc4a24 100755 --- a/commands/usage.help +++ b/commands/usage.help @@ -27,6 +27,7 @@ Warden version $(cat ${WARDEN_DIR}/version) redis Interacts with the redis service on an environment (see 'warden redis -h' for details) install Initializes or updates warden configuration on host machine shell Launches into a shell within the current project environment + status Display list of all running Warden project environments debug Launches debug enabled shell within current project environment sign-certificate Signs a wildcard certificate including all passed hostnames on the SAN list version Show version information From 64e754feff216edd57bfab0ed3b8173e3266a40b Mon Sep 17 00:00:00 2001 From: Navarr Date: Mon, 10 Jul 2023 09:29:02 -0400 Subject: [PATCH 05/10] Ensure Mutagen commands are only ran when Mutagen is being used Fixes #672 --- commands/env.cmd | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/commands/env.cmd b/commands/env.cmd index 570e9e55..9df78d52 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -6,6 +6,7 @@ loadEnvConfig "${WARDEN_ENV_PATH}" || exit $? assertDockerRunning if (( ${#WARDEN_PARAMS[@]} == 0 )) || [[ "${WARDEN_PARAMS[0]}" == "help" ]]; then + # shellcheck disable=SC2153 $WARDEN_BIN env --help || exit $? && exit $? fi @@ -14,7 +15,7 @@ trap '' ERR ## define source repository if [[ -f "${WARDEN_HOME_DIR}/.env" ]]; then - eval "$(cat "${WARDEN_HOME_DIR}/.env" | sed 's/\r$//g' | grep "^WARDEN_")" + eval "$(sed 's/\r$//g' < "${WARDEN_HOME_DIR}/.env" | grep "^WARDEN_")" fi export WARDEN_IMAGE_REPOSITORY="${WARDEN_IMAGE_REPOSITORY:-"docker.io/wardenenv"}" @@ -43,7 +44,8 @@ fi export CHOWN_DIR_LIST=${WARDEN_CHOWN_DIR_LIST:-} if [[ ${WARDEN_ENV_TYPE} == "magento1" && -f "${WARDEN_ENV_PATH}/.modman/.basedir" ]]; then - export NGINX_PUBLIC='/'$(cat "${WARDEN_ENV_PATH}/.modman/.basedir") + NGINX_PUBLIC='/'$(cat "${WARDEN_ENV_PATH}/.modman/.basedir") + export NGINX_PUBLIC fi if [[ ${WARDEN_ENV_TYPE} == "magento2" ]]; then @@ -161,12 +163,13 @@ if [[ "${WARDEN_PARAMS[0]}" == "up" ]]; then fi ## lookup address of traefik container on environment network -export TRAEFIK_ADDRESS="$(docker container inspect traefik \ +TRAEFIK_ADDRESS="$(docker container inspect traefik \ --format ' {{- $network := index .NetworkSettings.Networks "'"$(renderEnvNetworkName)"'" -}} {{- if $network }}{{ $network.IPAddress }}{{ end -}} ' 2>/dev/null || true )" +export TRAEFIK_ADDRESS; if [[ $OSTYPE =~ ^darwin ]]; then export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" @@ -191,15 +194,15 @@ then $WARDEN_BIN sync pause fi -## pass ochestration through to docker compose +## pass orchestration through to docker compose ${DOCKER_COMPOSE_COMMAND} \ --project-directory "${WARDEN_ENV_PATH}" -p "${WARDEN_ENV_NAME}" \ "${DOCKER_COMPOSE_ARGS[@]}" "${WARDEN_PARAMS[@]}" "$@" ## resume mutagen sync if available and php-fpm container id hasn't changed -if ([[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]) \ +if { [[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]; } \ && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] \ - && [[ $($WARDEN_BIN sync list | grep -i 'Status: \[Paused\]' | wc -l | awk '{print $1}') == "1" ]] \ + && [[ $($WARDEN_BIN sync list | grep -ci 'Status: \[Paused\]' | awk '{print $1}') == "1" ]] \ && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] \ && [[ $($WARDEN_BIN env ps -q php-fpm) = $($WARDEN_BIN sync list | grep -i 'URL: docker' | awk -F'/' '{print $3}') ]] @@ -207,20 +210,22 @@ then $WARDEN_BIN sync resume fi -MUTAGEN_VERSION=$(mutagen version) -CONNECTION_STATE_STRING='Connected state: Connected' -if [[ $(version "${MUTAGEN_VERSION}") -ge $(version '0.15.0') ]]; then - CONNECTION_STATE_STRING='Connected: Yes' -fi - -## start mutagen sync if needed -if ([[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]) \ - && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] \ - && [[ $($WARDEN_BIN sync list | grep -c "${CONNECTION_STATE_STRING}" | awk '{print $1}') != "2" ]] \ - && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ - && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] +if [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] # If we're using Mutagen then - $WARDEN_BIN sync start + MUTAGEN_VERSION=$(mutagen version) + CONNECTION_STATE_STRING='Connected state: Connected' + if [[ $(version "${MUTAGEN_VERSION}") -ge $(version '0.15.0') ]]; then + CONNECTION_STATE_STRING='Connected: Yes' + fi + + ## start mutagen sync if needed + if { [[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]; } \ + && [[ $($WARDEN_BIN sync list | grep -c "${CONNECTION_STATE_STRING}" | awk '{print $1}') != "2" ]] \ + && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ + && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] + then + $WARDEN_BIN sync start + fi fi ## stop mutagen sync if needed From 7552701160e236dcb87229959ba261e0d43fa001 Mon Sep 17 00:00:00 2001 From: Navarr Date: Mon, 10 Jul 2023 09:36:19 -0400 Subject: [PATCH 06/10] Added Changelog for 0.14.1 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c90d7b..745f1fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ ## UNRELEASED [x.y.z](https://github.com/davidalger/warden/tree/x.y.z) (yyyy-mm-dd) [All Commits](https://github.com/davidalger/warden/compare/0.13.1..develop) --> +## Version [0.14.1](https://github.com/wardenenv/warden/tree/0.14.1) (2023-07-10) +[All Commits](https://github.com/wardenenv/warden/compoare/0.14.0..0.14.1) + +**Enhancements:** +* `warden status` command added that shows running Warden environments ([#669](https://github.com/wardenenv/warden/pull/669) by @bap14) + +**Bug Fixes:** +* Updated Mutagen connection detection so that Mutagen doesn't resync every time in versions >= 0.15.0 + ## Version [0.14.0](https://github.com/wardenenv/warden/tree/0.14.0) (2023-06-19) [All Commits](https://github.com/wardenenv/warden/compare/0.13.1..0.14.0) From 1bca12d58a057eeb25d3036edcac0292e6a6fe8f Mon Sep 17 00:00:00 2001 From: Andre Santos Date: Fri, 14 Jul 2023 09:50:34 -0300 Subject: [PATCH 07/10] Introduce ability to overwrite commands --- bin/warden | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/warden b/bin/warden index 014031b4..2e813126 100755 --- a/bin/warden +++ b/bin/warden @@ -52,12 +52,7 @@ if (( "$#" )); then ## local project directory if running within one; don't fail if it can't be found WARDEN_ENV_PATH="$(locateEnvPath 2>/dev/null)" || true - if [[ -f "${WARDEN_DIR}/commands/${1}.cmd" ]]; then - WARDEN_CMD_VERB="$1" - WARDEN_CMD_EXEC="${WARDEN_DIR}/commands/${1}.cmd" - WARDEN_CMD_HELP="${WARDEN_DIR}/commands/${1}.help" - shift - elif [[ -f "${WARDEN_ENV_PATH}/.warden/commands/${1}.cmd" ]]; then + if [[ -f "${WARDEN_ENV_PATH}/.warden/commands/${1}.cmd" ]]; then WARDEN_CMD_VERB="$1" WARDEN_CMD_ANYARGS+=("$1") WARDEN_CMD_EXEC="${WARDEN_ENV_PATH}/.warden/commands/${1}.cmd" @@ -69,6 +64,11 @@ if (( "$#" )); then WARDEN_CMD_EXEC="${WARDEN_HOME_DIR}/commands/${1}.cmd" WARDEN_CMD_HELP="${WARDEN_HOME_DIR}/commands/${1}.help" shift + elif [[ -f "${WARDEN_DIR}/commands/${1}.cmd" ]]; then + WARDEN_CMD_VERB="$1" + WARDEN_CMD_EXEC="${WARDEN_DIR}/commands/${1}.cmd" + WARDEN_CMD_HELP="${WARDEN_DIR}/commands/${1}.help" + shift else WARDEN_HELP=1 fi From f7a1ce86e11ce3a507dc10372303f677ec5b0e01 Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Fri, 14 Jul 2023 09:02:10 -0400 Subject: [PATCH 08/10] Add Changelog for #676 --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 745f1fef..58e1cd99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # Change Log - +[All Commits](https://github.com/davidalger/warden/compare/0.14.1..main) + +**Enhancements:** +* Project and Local Warden commands will now take precedence over built-in warden commands ([#676](https://github.com/wardenenv/warden/pull/676) by @flpandre) + ## Version [0.14.1](https://github.com/wardenenv/warden/tree/0.14.1) (2023-07-10) [All Commits](https://github.com/wardenenv/warden/compoare/0.14.0..0.14.1) From 9b3c3872c128ebdc3ac89f298e358965d1ae3eb3 Mon Sep 17 00:00:00 2001 From: Brett Patterson Date: Sun, 30 Jul 2023 13:54:40 -0400 Subject: [PATCH 09/10] Fix stripping of '-' character from project names/urls --- commands/status.cmd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/status.cmd b/commands/status.cmd index 1d273bb5..46b03edb 100644 --- a/commands/status.cmd +++ b/commands/status.cmd @@ -17,7 +17,8 @@ IFS="$OLDIFS" messageList=() for projectNetwork in "${projectNetworkList[@]}"; do - [[ -z "${projectNetwork}" || "${projectNetwork}" == "${wardenNetworkName}" ]] && continue # Skip empty project network names (if any) + # Skip empty names and the Warden core services network + test -z "${projectNetwork}" -o "${projectNetwork}" = "${wardenNetworkName}" && continue prefix="${projectNetwork%_default}" prefixLen="${#prefix}" @@ -28,9 +29,9 @@ for projectNetwork in "${projectNetworkList[@]}"; do [[ -z "${container}" ]] && continue # Project is not running, skip it projectDir=$(docker container inspect --format '{{ index .Config.Labels "com.docker.compose.project.working_dir"}}' "$container") - projectName=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_NAME=' | sed -e 's/WARDEN_ENV_NAME=[[:space:]]*//g' | tr -d -) - projectType=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_TYPE=' | sed -e 's/WARDEN_ENV_TYPE=[[:space:]]*//g' | tr -d -) - traefikDomain=$(cat "${projectDir}/.env" | grep '^TRAEFIK_DOMAIN=' | sed -e 's/TRAEFIK_DOMAIN=[[:space:]]*//g' | tr -d -) + projectName=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_NAME=' | sed -e 's/WARDEN_ENV_NAME=[[:space:]]*//g') + projectType=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_TYPE=' | sed -e 's/WARDEN_ENV_TYPE=[[:space:]]*//g') + traefikDomain=$(cat "${projectDir}/.env" | grep '^TRAEFIK_DOMAIN=' | sed -e 's/TRAEFIK_DOMAIN=[[:space:]]*//g') messageList+=(" \033[1;35m${projectName}\033[0m a \033[36m${projectType}\033[0m project") messageList+=(" Project Directory: \033[33m${projectDir}\033[0m") From e942e662758760e21c1164fc9d18e11fb428033f Mon Sep 17 00:00:00 2001 From: Brett Patterson Date: Sun, 30 Jul 2023 14:00:47 -0400 Subject: [PATCH 10/10] Add subdomain to url if specified --- commands/status.cmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands/status.cmd b/commands/status.cmd index 46b03edb..49d0bc0d 100644 --- a/commands/status.cmd +++ b/commands/status.cmd @@ -32,10 +32,16 @@ for projectNetwork in "${projectNetworkList[@]}"; do projectName=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_NAME=' | sed -e 's/WARDEN_ENV_NAME=[[:space:]]*//g') projectType=$(cat "${projectDir}/.env" | grep '^WARDEN_ENV_TYPE=' | sed -e 's/WARDEN_ENV_TYPE=[[:space:]]*//g') traefikDomain=$(cat "${projectDir}/.env" | grep '^TRAEFIK_DOMAIN=' | sed -e 's/TRAEFIK_DOMAIN=[[:space:]]*//g') + traefikSubdomain=$(cat "${projectDir}/.env" | grep '^TRAEFIK_SUBDOMAIN=' | sed -e 's/TRAEFIK_SUBDOMAIN=[[:space:]]*//g') + + fullDomain="${traefikDomain}" + if test -n "${traefikSubdomain}"; then + fullDomain="${traefikSubdomain}.${traefikDomain}" + fi messageList+=(" \033[1;35m${projectName}\033[0m a \033[36m${projectType}\033[0m project") messageList+=(" Project Directory: \033[33m${projectDir}\033[0m") - messageList+=(" Project URL: \033[94mhttps://${traefikDomain}\033[0m") + messageList+=(" Project URL: \033[94mhttps://${fullDomain}\033[0m") [[ "$projectNetwork" != "${projectNetworkList[@]: -1:1}" ]] && messageList+=() done