+21
-2
@@ -4,10 +4,16 @@ import (
|
||||
"flag"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/auth"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/database"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/http"
|
||||
)
|
||||
|
||||
var config pq.Config
|
||||
var (
|
||||
oidcIssuer, oidcClientID, oidcClientSecret, oidcRedirectURI string
|
||||
jwtSigningKey string
|
||||
)
|
||||
|
||||
func main() {
|
||||
handleflag()
|
||||
@@ -15,9 +21,15 @@ func main() {
|
||||
database.OpenDB(config)
|
||||
defer database.CloseDB()
|
||||
|
||||
for {
|
||||
|
||||
auth.SetSigningKey(jwtSigningKey)
|
||||
if err := auth.InitProvider(oidcIssuer, oidcClientID, oidcClientSecret, oidcRedirectURI); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := http.Start(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func handleflag() {
|
||||
@@ -28,5 +40,12 @@ func handleflag() {
|
||||
flag.StringVar(&config.User, "dbuser", "postgres", "Postgres user")
|
||||
flag.StringVar(&config.Password, "dbpass", "", "Postgres password")
|
||||
|
||||
flag.StringVar(&oidcIssuer, "oidcIssuer", "", "The OIDC Issuer")
|
||||
flag.StringVar(&oidcClientID, "oidcClientID", "", "The OIDC Client ID")
|
||||
flag.StringVar(&oidcClientSecret, "oidcClientSecret", "", "The OIDC Client Secret")
|
||||
flag.StringVar(&oidcRedirectURI, "oidcRedirectURI", "", "The OIDC Redirect URI")
|
||||
|
||||
flag.StringVar(&jwtSigningKey, "signingKey", "UNSAFE", "The JWT signingkey")
|
||||
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user