From 722a4f1509a95c95b872a1af99f4d1fe240f3ca2 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 5 Feb 2022 15:40:55 +0000
Subject: [PATCH] Provide defaults for webauthn config

They are not usable defaults, but they will allow the server to start
if you're not interested in using WebAuthN.

Fixes issue #16.
---
 cmd/auth-server/main.go | 2 +-
 server/config.go        | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/cmd/auth-server/main.go b/cmd/auth-server/main.go
index fdcbe4fa..8dfd5d0d 100644
--- a/cmd/auth-server/main.go
+++ b/cmd/auth-server/main.go
@@ -107,7 +107,7 @@ func main() {
 
 	authSrv, err := server.NewServer(config)
 	if err != nil {
-		log.Fatalf("configuration error: %v", err)
+		log.Fatalf("error: %v", err)
 	}
 
 	tracing.Init()
diff --git a/server/config.go b/server/config.go
index a43238c9..10125879 100644
--- a/server/config.go
+++ b/server/config.go
@@ -107,6 +107,13 @@ func LoadConfig(path string) (*Config, error) {
 			"file": yaml.Node{},
 		},
 	}
+	// Defaults for WebAuthn config are only supposed to
+	// let the program start without issues, they will not
+	// result in a usable WebAuthN setup.
+	config.WebAuthn.RPDisplayName = "localhost"
+	config.WebAuthn.RPID = "localhost"
+	config.WebAuthn.RPOrigin = "localhost"
+
 	if err := backend.LoadYAML(path, &config); err != nil {
 		return nil, err
 	}
-- 
GitLab