added Dockerfile & added --port --domain --skip-config-check flags

This commit is contained in:
partisan 2024-11-21 12:30:16 +01:00
parent 3ca7d57680
commit 28f71271d7
5 changed files with 249 additions and 18 deletions

42
run.bat
View file

@ -1,6 +1,36 @@
@echo off
setlocal enabledelayedexpansion
rem Initialize variables
set SKIP_CONFIG=""
set PORT=""
set DOMAIN=""
rem Parse arguments
:parse_args
if "%~1"=="" goto end_parse
if "%~1"=="--port" (
set PORT=%~2
shift
shift
goto parse_args
)
if "%~1"=="--domain" (
set DOMAIN=%~2
shift
shift
goto parse_args
)
if "%~1"=="--skip-config-check" (
set SKIP_CONFIG=--skip-config-check
shift
goto parse_args
)
echo Unknown argument: %~1
exit /b 1
:end_parse
rem Use the current directory where the script is executed
pushd %~dp0
@ -10,8 +40,16 @@ for %%f in (*.go) do (
set GO_FILES=!GO_FILES! %%f
)
rem Run the Go program with all the .go files
go run !GO_FILES!
rem Construct the command
set CMD=go run !GO_FILES! !SKIP_CONFIG!
if not "%PORT%"=="" set CMD=!CMD! --port %PORT%
if not "%DOMAIN%"=="" set CMD=!CMD! --domain %DOMAIN%
rem Informative output
echo Starting application with command: !CMD!
rem Run the Go program with the constructed command
call !CMD!
rem Return to the original directory
popd