diff --git a/CHANGELOG.md b/CHANGELOG.md
index 706b36a..070c720 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+- macOS support
+
### Changed
- Remove parallel requests improvement, because it's buggy in some situations...
diff --git a/README.md b/README.md
index 83ed0b8..282d30c 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,7 @@ You will need these dependencies installed:
- [jq](https://stedolan.github.io/jq/)* (>= 1.5.1)
- [timeout](https://man7.org/linux/man-pages/man1/timeout.1.html)* For macOS run: `brew install coreutils`
- [uuidgen](https://man7.org/linux/man-pages/man1/uuidgen.1.html) only for some OS (Debian and Alpine work fine without it)
+- greadlink Only for macOS run: `brew install coreutils`
\* = required
diff --git a/psu b/psu
index 08aed22..39a5592 100755
--- a/psu
+++ b/psu
@@ -970,6 +970,17 @@ curl_wrapper() {
fi
}
+# Readlink command wrapper
+# useful to support macOS, run:
+# brew install coreutils
+readlink_wrapper() {
+ if [ -x "$(command -v greadlink)" ]; then
+ greadlink "$@"
+ else
+ readlink "$@"
+ fi
+}
+
###################################################
############### actions section ###################
###################################################
@@ -996,10 +1007,10 @@ deploy() {
if [ "$DOCKER_COMPOSE_LINT" == "true" ]; then
lint
fi
+ echo_debug "DOCKER_COMPOSE_FILE -> $DOCKER_COMPOSE_FILE"
# Read docker-compose file content
local docker_compose_file_content
- docker_compose_file_content="$( jq -Rscjr '{StackFileContent: . }' $DOCKER_COMPOSE_FILE | tail -c +2 | head -c -1 )"
- echo_debug "DOCKER_COMPOSE_FILE -> $DOCKER_COMPOSE_FILE"
+ docker_compose_file_content="$(jq -Rscjr '{StackFileContent: .}' "$DOCKER_COMPOSE_FILE" | sed -e 's/^{//' -e 's/}$//')"
echo_debug "docker_compose_file_content -> $docker_compose_file_content"
local json_temp_path
@@ -1328,7 +1339,12 @@ lint() {
# JSON string #
###################################################
env_file_to_json() {
- env -i sh -c "(unset \$(env | sed 's/=.*//'); set -a; . $(readlink -f $ENVIRONMENT_VARIABLES_FILE); set +a; jq -njc 'env | to_entries | map({name: .key, value: .value})')"
+ local jq_command
+
+ # For macOS compatibility
+ jq_command="$(which jq)"
+
+ env -i sh -c "(unset \$(env | sed 's/=.*//'); set -a; . $(readlink_wrapper -f $ENVIRONMENT_VARIABLES_FILE); set +a; \"$jq_command\" -njc 'env | to_entries | map({name: .key, value: .value})')"
}
# Set the ACTIONS variable who's a list of all psu actions