From 15485bfec73ed289109222bd015c0c8dc1191824 Mon Sep 17 00:00:00 2001 From: Akis Kesoglou Date: Sun, 21 Oct 2018 02:03:46 +0200 Subject: [PATCH] minor formatting improvements --- README.md | 4 ++-- compose/template.yml | 2 +- scripts/patch-hosts | 3 +-- scripts/select-project | 10 +++++----- scripts/start-project | 32 ++++++++++++++++---------------- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 79d0c65..4a0a129 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ command. If you wish to run the platform under a specific domain name, you can specify it as the second argument. The default is `openbalena.local`. For example: - $ ./scripts/start-project mydeployment my.domain.com + $ ./scripts/start-project -n mydeployment -d mydomain.com You can create as many deployments as needed and switch between them using: - $ ./scripts/select-project mydeployment + $ ./scripts/select-project -n mydeployment Remove all traces of a project by deleting its folder. diff --git a/compose/template.yml b/compose/template.yml index ad2b9e0..9092271 100644 --- a/compose/template.yml +++ b/compose/template.yml @@ -6,5 +6,5 @@ # when specifying multiple configs and open-balena always specifying # `compose/services.yml` as the "base" config. # -# You may view the effective config with `scripts/run-fig-command config`. +# You may view the effective config with `scripts/compose config`. version: '2.1' diff --git a/scripts/patch-hosts b/scripts/patch-hosts index 6e02d4b..6772424 100755 --- a/scripts/patch-hosts +++ b/scripts/patch-hosts @@ -1,7 +1,5 @@ #!/bin/bash -e -SERVICES="api registry vpn db s3 redis" - usage() { echo "usage: $0 DOMAIN" echo @@ -14,6 +12,7 @@ if [ -z "$1" ]; then exit 1 fi +SERVICES="api registry vpn db s3 redis" DOMAIN="$1" # We need sudo to write to /etc/hosts, so first write to a temp file and then diff --git a/scripts/select-project b/scripts/select-project index dd9e50e..8c6b4e8 100755 --- a/scripts/select-project +++ b/scripts/select-project @@ -1,9 +1,5 @@ #!/bin/bash -e -CMD="$0" -DIR="$(dirname "$CMD")" -BASE_DIR="$(dirname "$DIR")" - usage() { echo "usage: $0 PROJECT_PATH" echo @@ -16,8 +12,12 @@ if [ -z "$1" ]; then exit 1 fi +CMD="$0" +DIR="$(dirname "${CMD}")" +BASE_DIR="$(dirname "${DIR}")" + PROJECT_PATH="$1" -PROJECT_DIR="$(realpath "$PROJECT_PATH")" +PROJECT_DIR="$(realpath "${PROJECT_PATH}")" if [ ! -d "$PROJECT_DIR" ]; then echo 'Project path refers to a directory that does not exist.' diff --git a/scripts/start-project b/scripts/start-project index bfefc20..727ba41 100755 --- a/scripts/start-project +++ b/scripts/start-project @@ -1,8 +1,8 @@ #!/bin/bash -e -CMD=$0 -DIR=$(dirname "$CMD") -BASE_DIR=$(dirname "$DIR") +CMD="$0" +DIR=$(dirname "${CMD}") +BASE_DIR=$(dirname "${DIR}") PROJECT_NAME=demo DOMAIN=openbalena.local @@ -19,17 +19,17 @@ usage() { show_help=false patch_hosts=false while getopts ":hpn:d:" opt; do - case "${opt}" in - h) show_help=true;; - p) patch_hosts=true;; - n) PROJECT_NAME="${OPTARG}";; - d) DOMAIN="${OPTARG}";; - *) - echo "Invalid argument: -${OPTARG}" - usage - exit 1 - ;; - esac + case "${opt}" in + h) show_help=true;; + p) patch_hosts=true;; + n) PROJECT_NAME="${OPTARG}";; + d) DOMAIN="${OPTARG}";; + *) + echo "Invalid argument: -${OPTARG}" + usage + exit 1 + ;; + esac done shift $((OPTIND-1)) @@ -37,8 +37,8 @@ PROJECT_DIR="$(pwd)/${PROJECT_NAME}" CERTS_DIR="${PROJECT_DIR}/certs" if [ "$show_help" = "true" ]; then - usage - exit 1 + usage + exit 1 fi echo_bold() {