File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44nodeprefix=" m"
55
66script_args=()
7+ env_vars=()
78while [[ $1 = -* ]]; do
89 if [[ " $1 " = " -s" ]] || [[ " $1 " = " --source" ]]; then
910 shift
@@ -23,6 +24,9 @@ while [[ $1 = -* ]]; do
2324 elif [[ " $1 " = " -a" ]] || [[ " $1 " = " --file-arg" ]]; then
2425 shift
2526 script_args+=(" $1 " )
27+ elif [[ " $1 " = " -e" ]] || [[ " $1 " = " --env" ]]; then
28+ shift
29+ env_vars+=(" $1 " ) # expect VAR=VALUE
2630 fi
2731 shift
2832done
@@ -73,6 +77,20 @@ echo $cluster >common/cluster
7377ssh-keygen -N " " -f common/id_rsa
7478
7579compose=docker-compose.yml
80+
81+ append_env_to_compose () {
82+ if (( ${# env_vars[@]} > 0 )) ; then
83+ cat >> $compose << EOF
84+ environment:
85+ EOF
86+ for e in " ${env_vars[@]} " ; do
87+ cat >> $compose << EOF
88+ - ${e}
89+ EOF
90+ done
91+ fi
92+ }
93+
7694cat > $compose << EOF
7795version: '2'
7896
104122EOF
105123}
106124
125+ append_env_to_compose
126+
107127cat >> $compose << EOF
108128 command: /client $commands
109129 cap_add:
140160EOF
141161
142162}
163+
164+ append_env_to_compose
165+
143166cat >> $compose << EOF
144167 command: /server
145168 cap_add:
You can’t perform that action at this time.
0 commit comments