Skip to content

Commit

Permalink
refactor and combine client and server.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham3121 committed May 1, 2024
1 parent bffeefa commit c3c043e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
3 changes: 1 addition & 2 deletions packages/grid/rathole/rathole.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ ENV APP_LOG_LEVEL="info"
COPY --from=build /rathole/target/release/rathole /app/rathole
RUN apt update && apt install -y netcat-openbsd vim
WORKDIR /app
COPY ./start-client.sh /app/start-client.sh
COPY ./start-server.sh /app/start-server.sh
COPY ./start.sh /app/start.sh
COPY ./client.toml /app/client.toml
COPY ./server.toml /app/server.toml
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
Expand Down
13 changes: 0 additions & 13 deletions packages/grid/rathole/start-client.sh

This file was deleted.

13 changes: 0 additions & 13 deletions packages/grid/rathole/start-server.sh

This file was deleted.

20 changes: 20 additions & 0 deletions packages/grid/rathole/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

APP_MODULE=server.main:app
LOG_LEVEL=${LOG_LEVEL:-info}
HOST=${HOST:-0.0.0.0}
PORT=${APP_PORT:-5555}
RELOAD="--reload"
DEBUG_CMD=""
RATHOLE_MODE=${RATHOLE_MODE:-server}

apt update && apt install -y nginx
nginx & exec python -m $DEBUG_CMD uvicorn $RELOAD --host $HOST --port $APP_PORT --log-level $LOG_LEVEL "$APP_MODULE" &

if [[ $RATHOLE_MODE == "server" ]]; then
/app/rathole server.toml
elif [[ $RATHOLE_MODE = "client" ]]; then
/app/rathole client.toml
else
echo "RATHOLE_MODE is set to an invalid value. Exiting."
fi

0 comments on commit c3c043e

Please sign in to comment.