Use double-hyphen style CLI flags with pflag
This commit is contained in:
parent
6ef558d44d
commit
1c9578cb56
3 changed files with 8 additions and 5 deletions
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
|
@ -13,13 +12,14 @@ import (
|
|||
"github.com/imc-vibe/backend/internal/auth"
|
||||
"github.com/imc-vibe/backend/internal/config"
|
||||
"github.com/imc-vibe/backend/internal/db"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resetAdminPassword := flag.Bool("reset-admin-password", false, "Reset admin password to a random value and exit")
|
||||
bind := flag.String("bind", "", "IP address to bind to (default: 0.0.0.0)")
|
||||
port := flag.String("port", "", "Port to listen on (default: 8080)")
|
||||
flag.Parse()
|
||||
resetAdminPassword := pflag.Bool("reset-admin-password", false, "Reset admin password to a random value and exit")
|
||||
bind := pflag.StringP("bind", "b", "", "IP address to bind to (default: 0.0.0.0)")
|
||||
port := pflag.StringP("port", "p", "", "Port to listen on (default: 8080)")
|
||||
pflag.Parse()
|
||||
|
||||
cfg := config.Load()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue