From 4c0e1bc89de2a60baaa098c049cf69bac8537055 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Fri, 8 Sep 2023 14:54:59 -0600 Subject: finger support --- config.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'config.go') diff --git a/config.go b/config.go index 4be0790..6af9808 100644 --- a/config.go +++ b/config.go @@ -21,11 +21,22 @@ type config struct { tlsCertFile string uploaderFingerprints []string + + fingerResponses map[string]string } func configure() config { fingerprints := strings.Split(os.Getenv("UPLOADER_FINGERPRINTS"), ",") + fingers := map[string]string{} + for _, pair := range os.Environ() { + key, val, _ := strings.Cut(pair, "=") + if !strings.HasPrefix(key, "FINGER_") { + continue + } + fingers[strings.ToLower(key[7:])] = val + } + return config{ hostname: os.Getenv("HOST_NAME"), geminiRoot: os.Getenv("GEMINI_ROOT"), @@ -33,6 +44,8 @@ func configure() config { tlsCertFile: os.Getenv("TLS_CERT_FILE"), uploaderFingerprints: fingerprints, + + fingerResponses: fingers, } } -- cgit v1.2.3