Skip to content

Commit a30b9ec

Browse files
authored
Merge pull request #2 from digital-entropy/dev
chore: remove unused code, fix wrong rrun and crun call
2 parents e4a43b5 + 9ffa4b1 commit a30b9ec

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

bin/nge

+5-26
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export NGE_USER=${NGE_USER:-$USER}
132132
export NGE_PUID=${NGE_PUID:-$UID}
133133
export NGE_PGID=${NGE_PGID:-$(id -g)}
134134

135-
export NGE_FILES=${NGE_FILES:-""}
136135
export NGE_EXPOSE_DASHBOARD=${NGE_EXPOSE_DASHBOARD:-4040}
137136
export NGE_EXPOSE_SERVER_HOST=${NGE_EXPOSE_SERVER_HOST:-"laravel-nge.site"}
138137
export NGE_EXPOSE_SERVER_PORT=${NGE_EXPOSE_SERVER_PORT:-8080}
@@ -160,28 +159,6 @@ function compose() {
160159
"${DOCKER_COMPOSE[@]}" $@
161160
}
162161

163-
# Define Docker Compose command prefix...
164-
if docker compose &> /dev/null; then
165-
DOCKER_COMPOSE=(docker compose)
166-
else
167-
DOCKER_COMPOSE=(docker-compose)
168-
fi
169-
170-
if [ -n "$NGE_FILES" ]; then
171-
# Convert NGE_FILES to an array...
172-
IFS=':' read -ra NGE_FILES <<< "$NGE_FILES"
173-
174-
for FILE in "${NGE_FILES[@]}"; do
175-
if [ -f "$FILE" ]; then
176-
DOCKER_COMPOSE+=(-f "$FILE")
177-
else
178-
echo "${BOLD}Unable to find Docker Compose file: '${FILE}'${NC}" >&2
179-
180-
exit 1
181-
fi
182-
done
183-
fi
184-
185162
EXEC="yes"
186163
if [ -z "$NGE_SKIP_CHECKS" ]; then
187164
# Ensure that Docker is running...
@@ -206,13 +183,15 @@ fi
206183
# running APP_SERVICE with `compose run|exec`
207184
function app_crun() {
208185
if [ $ONCE == "no" ]; then
186+
# run via new container
209187
if [ -z "$NGE_USER" ]; then
210188
echo "${YELLOW}NGE_USER not set. Running with default user.${NC}" >&2
211189
compose exec -it $APP_SERVICE $@
212190
else
213191
compose exec -it --user=$NGE_USER $APP_SERVICE $@
214192
fi
215193
else
194+
# run via existing container
216195
if [ -z "$NGE_USER" ]; then
217196
echo "${YELLOW}NGE_USER not set. Running with default user.${NC}" >&2
218197
compose run --rm $APP_SERVICE $@
@@ -322,15 +301,15 @@ function bash() {
322301
}
323302

324303
function root-shell() {
325-
rrun sh
304+
app_rrun sh
326305
}
327306

328307
function root-bash() {
329-
rrun bash
308+
app_rrun bash
330309
}
331310

332311
function tinker() {
333-
crun php artisan tinker
312+
app_crun php artisan tinker
334313
}
335314

336315
function expose() {

0 commit comments

Comments
 (0)