47 lines
1013 B
Go
47 lines
1013 B
Go
// Command sherlock-broker is the long-running per-user daemon that owns
|
|
// the Authentik OAuth state, caches per-service tokens, performs RFC 8693
|
|
// token exchange, and hosts the loopback HTTP listener for browser
|
|
// callbacks.
|
|
//
|
|
// Phase 0 ships only `version` so CI has something to build. The actual
|
|
// daemon lands in Phase 1.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// Version is overwritten at build time via -ldflags "-X main.Version=...".
|
|
var Version = "0.0.0-dev"
|
|
|
|
func main() {
|
|
flag.Usage = func() {
|
|
fmt.Fprintf(os.Stderr, `sherlock-broker - Charlie credential broker daemon (Phase 1+)
|
|
|
|
Usage:
|
|
sherlock-broker <subcommand> [args...]
|
|
|
|
Subcommands:
|
|
version Print the broker version and exit.
|
|
`)
|
|
}
|
|
flag.Parse()
|
|
|
|
args := flag.Args()
|
|
if len(args) == 0 {
|
|
flag.Usage()
|
|
os.Exit(2)
|
|
}
|
|
|
|
switch args[0] {
|
|
case "version", "--version", "-v":
|
|
fmt.Println(Version)
|
|
default:
|
|
fmt.Fprintf(os.Stderr, "sherlock-broker: unknown subcommand %q\n", args[0])
|
|
flag.Usage()
|
|
os.Exit(2)
|
|
}
|
|
}
|