This commit is contained in:
parent
f213c958f4
commit
f059715b41
3 changed files with 20 additions and 5 deletions
11
init.go
11
init.go
|
@ -13,10 +13,16 @@ func main() {
|
|||
portFlag := flag.Int("port", 0, "Port number to run the application (overrides config)")
|
||||
domainFlag := flag.String("domain", "", "Domain address for the application (overrides config)")
|
||||
skipConfigFlag := flag.Bool("skip-config-check", false, "Skip interactive prompts and load config.ini")
|
||||
configFlag := flag.String("config", "", "Path to configuration file (overrides default)")
|
||||
|
||||
// Parse command-line flags
|
||||
flag.Parse()
|
||||
|
||||
// Override global configFilePath if --config flag is provided
|
||||
if *configFlag != "" {
|
||||
configFilePath = *configFlag
|
||||
}
|
||||
|
||||
if *skipConfigFlag {
|
||||
// Skip interactive configuration
|
||||
if _, err := os.Stat(configFilePath); err == nil {
|
||||
|
@ -136,11 +142,6 @@ func main() {
|
|||
|
||||
webCrawlerInit()
|
||||
|
||||
// No longer needed as crawled data are indexed imidietly
|
||||
// // Start periodic indexing (every 2 minutes)
|
||||
// dataFilePath := filepath.Join(config.DriveCache.Path, "data_to_index.txt")
|
||||
// startPeriodicIndexing(dataFilePath, 2*time.Minute)
|
||||
|
||||
printInfo("Indexer is enabled.")
|
||||
} else {
|
||||
printInfo("Indexer is disabled.")
|
||||
|
|
8
run.bat
8
run.bat
|
@ -5,6 +5,7 @@ rem Initialize variables
|
|||
set SKIP_CONFIG=""
|
||||
set PORT=""
|
||||
set DOMAIN=""
|
||||
set CONFIG_FILE=""
|
||||
set BUILD_OUTPUT=qgato.exe
|
||||
|
||||
rem Parse arguments
|
||||
|
@ -22,6 +23,12 @@ if "%~1"=="--domain" (
|
|||
shift
|
||||
goto parse_args
|
||||
)
|
||||
if "%~1"=="--config" (
|
||||
set CONFIG_FILE=%~2
|
||||
shift
|
||||
shift
|
||||
goto parse_args
|
||||
)
|
||||
if "%~1"=="--skip-config-check" (
|
||||
set SKIP_CONFIG=--skip-config-check
|
||||
shift
|
||||
|
@ -60,6 +67,7 @@ rem Construct the command
|
|||
set CMD=%BUILD_OUTPUT% !SKIP_CONFIG!
|
||||
if not "%PORT%"=="" set CMD=!CMD! --port %PORT%
|
||||
if not "%DOMAIN%"=="" set CMD=!CMD! --domain %DOMAIN%
|
||||
if not "%CONFIG_FILE%"=="" set CMD=!CMD! --config %CONFIG_FILE%
|
||||
|
||||
rem Informative output
|
||||
echo Starting application with command: !CMD!
|
||||
|
|
6
run.sh
6
run.sh
|
@ -4,6 +4,7 @@
|
|||
SKIP_CONFIG=""
|
||||
PORT=""
|
||||
DOMAIN=""
|
||||
CONFIG_FILE=""
|
||||
BUILD_OUTPUT="qgato"
|
||||
|
||||
# Parse arguments
|
||||
|
@ -17,6 +18,10 @@ while [ $# -gt 0 ]; do
|
|||
DOMAIN=$2
|
||||
shift 2
|
||||
;;
|
||||
--config)
|
||||
CONFIG_FILE=$2
|
||||
shift 2
|
||||
;;
|
||||
--skip-config-check)
|
||||
SKIP_CONFIG="--skip-config-check"
|
||||
shift
|
||||
|
@ -51,6 +56,7 @@ fi
|
|||
CMD="$SCRIPT_DIR/$BUILD_OUTPUT $SKIP_CONFIG"
|
||||
[ -n "$PORT" ] && CMD="$CMD --port $PORT"
|
||||
[ -n "$DOMAIN" ] && CMD="$CMD --domain $DOMAIN"
|
||||
[ -n "$CONFIG_FILE" ] && CMD="$CMD --config $CONFIG_FILE"
|
||||
|
||||
echo "Starting application with command: $CMD"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue