Skip to content

Commit

Permalink
Put --server flag back
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Sep 3, 2024
1 parent 42be4e9 commit 3f7196f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import (
"flag"
"fmt"
"log/slog"
"net/http"
"os"
"reflect"
"regexp"
"strconv"
"strings"

"github.com/lehigh-university-libraries/fabricator/internal/contributor"
"github.com/lehigh-university-libraries/fabricator/internal/handlers"
"github.com/lehigh-university-libraries/fabricator/internal/tgn"
"github.com/lehigh-university-libraries/go-islandora/workbench"
)
Expand Down Expand Up @@ -232,12 +234,25 @@ func readCSVWithJSONTags(filePath string) (map[string]bool, []map[string][]strin
}

func main() {
var serverMode bool

// Define the source and target flags
flag.BoolVar(&serverMode, "server", false, "Set to true to run as server")
source := flag.String("source", "", "Path to the source CSV file")
target := flag.String("target", "", "Path to the target CSV file")
flag.Parse()

if serverMode {
// Start HTTP server
http.HandleFunc("/workbench/check", handlers.CheckMyWork)

slog.Info("Starting server on :8080")
if err := http.ListenAndServe(":8080", nil); err != nil {
panic(err)
}
}

// Define the source and target flags

if *source == "" || *target == "" {
fmt.Println("Source and target flags are required")
flag.Usage()
Expand Down

0 comments on commit 3f7196f

Please sign in to comment.