about summary refs log tree commit diff stats
path: root/import
diff options
context:
space:
mode:
Diffstat (limited to 'import')
-rw-r--r--import/main.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/import/main.go b/import/main.go
index 1e6b87d..b8ae633 100644
--- a/import/main.go
+++ b/import/main.go
@@ -13,15 +13,31 @@ import (
 	"searchix/internal/search"
 	"strings"
 	"time"
+
+	"github.com/ardanlabs/conf/v3"
 )
 
 const timeout = 30 * time.Minute
 
+type Config struct {
+	ConfigFile string `conf:"short:c"`
+}
+
 func main() {
 	if _, found := os.LookupEnv("DEBUG"); found {
 		slog.SetLogLoggerLevel(slog.LevelDebug)
 	}
-	cfg, err := config.GetConfig()
+	var runtimeConfig Config
+	help, err := conf.Parse("", &runtimeConfig)
+	if err != nil {
+		if errors.Is(err, conf.ErrHelpWanted) {
+			log.Println(help)
+			os.Exit(1)
+		}
+		log.Panicf("parsing runtime configuration: %v", err)
+	}
+
+	cfg, err := config.GetConfig(runtimeConfig.ConfigFile)
 	if err != nil {
 		log.Fatal(err)
 	}