-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
208 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,24 @@ | ||
default_cacheDir="$HOME"/.cache/cardano-workbench | ||
default_basePort=30000 | ||
WORKBENCH_ENV_DEFAULT=' | ||
{ "type": "supervisor" | ||
, "cacheDir": "'$HOME'/.cache/cardano-workbench" | ||
, "basePort": 30000 | ||
, "staggerPorts": true | ||
}' | ||
|
||
usage_env() { | ||
usage "env" "Environment setup" <<EOF | ||
compute-config [ENV-OPTS..] | ||
Compute the environment configuration JSON. | ||
The following environment config options are defined: | ||
export WORKBENCH_ENV=$WORKBENCH_ENV_DEFAULT | ||
|
||
--cache-dir DIR Set the cache directory; Defaults to $default_cachedir | ||
--base-port PORTNO Set base port number; Defaults to $default_basePort | ||
--stagger-ports Whether to allocate different ports for each node; | ||
Defaults to no port staggering | ||
EOF | ||
envjq() { | ||
jq ".$1" <<<$WORKBENCH_ENV | ||
} | ||
|
||
env() { | ||
local op=${1:---help)}; shift | ||
|
||
case "${op}" in | ||
compute-config ) | ||
local usage="USAGE: wb run OPTS.. print-env-config" | ||
|
||
local v=( | ||
--arg cacheDir "$default_cacheDir" | ||
--argjson basePort "$default_basePort" | ||
--argjson staggerPorts 'false' | ||
) | ||
|
||
while test $# -gt 0; do case "$1" in | ||
--cache-dir ) v=(--arg cacheDir "$2" "${v[@]}"); shift;; | ||
--base-port ) v=(--argjson basePort $2 "${v[@]}"); shift;; | ||
--stagger-ports ) v=(--argjson staggerPorts true "${v[@]}");; | ||
* ) fatal "wb run print-env-config: unknown args: $*";; esac | ||
shift; done | ||
envjqr() { | ||
jq -r ".$1" <<<$WORKBENCH_ENV | ||
} | ||
|
||
jq '{ cacheDir: $cacheDir | ||
, basePort: $basePort | ||
, staggerPorts: $staggerPorts | ||
}' --null-input "${v[@]}";; | ||
setenvjq() { | ||
export WORKBENCH_ENV=$(jq ". * { $1: $2 }" <<<$WORKBENCH_ENV) | ||
} | ||
|
||
* ) usage_env;; esac | ||
setenvjqstr() { | ||
setenvjq "$1" "\"$2\"" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.