move flag parsing to main.go

This commit is contained in:
2026-06-02 18:01:59 +00:00
parent b6fd060daf
commit e97c9cb86d
2 changed files with 7 additions and 6 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ import (
"context" "context"
"crypto/rand" "crypto/rand"
"crypto/tls" "crypto/tls"
"flag"
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
@@ -27,7 +28,11 @@ var Config common.Config
var UserSessions map[string]*UserSession var UserSessions map[string]*UserSession
var Realms map[string]Realm var Realms map[string]Realm
func Run(configPath *string, localDBPath *string) { func Run() {
configPath := flag.String("config", "config.json", "path to config.json file")
localDBPath := flag.String("localdb", "localdb.json", "path to localdb.json file")
flag.Parse()
// load config values // load config values
var err error var err error
Config = common.GetConfig(*configPath) Config = common.GetConfig(*configPath)
+1 -5
View File
@@ -2,12 +2,8 @@ package main
import ( import (
app "access-manager-api/app" app "access-manager-api/app"
"flag"
) )
func main() { func main() {
configPath := flag.String("config", "config.json", "path to config.json file") app.Run()
localDBPath := flag.String("localdb", "localdb.json", "path to localdb.json file")
flag.Parse()
app.Run(configPath, localDBPath)
} }