From 7ccda9d1be8361bf61ed40821a5fdc754425eee8 Mon Sep 17 00:00:00 2001 From: Jan Halfar Date: Tue, 11 Jul 2017 14:24:14 +0200 Subject: [PATCH] using passed in basic auth to avoid conficts, if given --- foomo/foomo.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/foomo/foomo.go b/foomo/foomo.go index d6c39d5..831008b 100644 --- a/foomo/foomo.go +++ b/foomo/foomo.go @@ -79,6 +79,14 @@ func makeFoomo(foomoDir string, runMode string, address string, init bool) (f *F } func (f *Foomo) setupBasicAuthCredentials() error { + if f.URL.User != nil { + f.basicAuthCredentials.user = f.URL.User.Username() + password, passwordOK := f.URL.User.Password() + if passwordOK { + f.basicAuthCredentials.password = password + return nil + } + } f.basicAuthCredentials.user = "gofoomo" f.basicAuthCredentials.password = makeToken(50) return htpasswd.SetPassword(f.GetBasicAuthFilename("default"), f.basicAuthCredentials.user, f.basicAuthCredentials.password, htpasswd.HashBCrypt)