diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/s4o/main.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cmd/s4o/main.go b/cmd/s4o/main.go new file mode 100644 index 0000000..c305f20 --- /dev/null +++ b/cmd/s4o/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "strings" + + flag "github.com/spf13/pflag" + + "git.sr.ht/~gabrielgio/s4o/server" +) + +func main() { + var ( + clientID = flag.String("client-id", "", "Client ID") + clientSecret = flag.String("client-secret", "", "Client Secret") + issuer = flag.String("issuer", "", "Issuer") + callback = flag.String("callback", "http://localhost:3000/callback", "Callback") + addr = flag.String("addr", ":3000", "serves HTTP requests from the given TCP addr") + scopes = flag.String("scopes", "openid", "Scopes") + rootPath = flag.String("rootPath", "./public", "Roo path") + ) + + flag.Parse() + + scopeSlice := strings.Split(*scopes, " ") + + fastServer, _ := server.NewS4OServer( + *clientID, + *clientSecret, + *issuer, + *callback, + *rootPath, + scopeSlice, + ) + + fmt.Println("Running server") + fastServer.ListenAndServe(*addr) +} |