Skip to content

Commit e204e13

Browse files
committed
make flags work
1 parent 945b25a commit e204e13

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

litepipe.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/sha1"
66
"encoding/hex"
77
"encoding/json"
8+
"flag"
89
"fmt"
910
"io"
1011
"net/http"
@@ -29,7 +30,12 @@ func main() {
2930
}
3031

3132
func loadConfig() {
32-
file, err := os.Open("config.json")
33+
// load flags
34+
configPath := flag.String("config", "config.json", "The path to the config file")
35+
36+
flag.Parse()
37+
38+
file, err := os.Open(*configPath)
3339
if err != nil {
3440
fmt.Printf("Error opening config file: %v\n", err)
3541
os.Exit(1)
@@ -66,7 +72,7 @@ func setDefaultsAndValidateConfig() {
6672
func start() {
6773
http.HandleFunc("/", HandleWebhook)
6874

69-
fmt.Println("\n\033[30;46m LitePipe \033[0m version 0.1.8")
75+
fmt.Println("\n\033[30;46m LitePipe \033[0m version 0.1.9")
7076
fmt.Printf("PID: %d\n", os.Getpid())
7177
fmt.Printf("Listening on port %d\n\n", config.Port)
7278

0 commit comments

Comments
 (0)