Use the realpath of the env file to be able to source it

Without this commit:
This command works correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g ./env_vars

But this command doesn't work correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g env_vars
This commit is contained in:
Tortue Torche 2019-05-29 10:25:33 +02:00 committed by GitHub
parent 0828e59bc7
commit e386126466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
psu
View File

@ -470,7 +470,7 @@ undeploy() {
# JSON string #
###################################################
env_file_to_json() {
echo "$(env -i sh -c "(unset \$(env | sed 's/=.*//'); set -a; . $ENVIRONMENT_VARIABLES_FILE; set +a; jq -njc 'env | to_entries | map({name: .key, value: .value})')")"
echo "$(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})')")"
}
main "$@"