mirror of
https://github.com/1f349/orchid.git
synced 2024-12-21 23:54:12 +00:00
Fix broken logging
This commit is contained in:
parent
dee4b7ee3a
commit
5532aa9782
@ -46,7 +46,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa
|
|||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
logger.Logger.Info("[Orchid] Error: missing config file")
|
logger.Logger.Info("[Orchid] Error: missing config file")
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Info("[Orchid] Error: open config file: ", err)
|
logger.Logger.Info("[Orchid] Error: open config file: ", "err", err)
|
||||||
}
|
}
|
||||||
return subcommands.ExitFailure
|
return subcommands.ExitFailure
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa
|
|||||||
var conf startUpConfig
|
var conf startUpConfig
|
||||||
err = yaml.NewDecoder(openConf).Decode(&conf)
|
err = yaml.NewDecoder(openConf).Decode(&conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Info("[Orchid] Error: invalid config file: ", err)
|
logger.Logger.Info("[Orchid] Error: invalid config file: ", "err", err)
|
||||||
return subcommands.ExitFailure
|
return subcommands.ExitFailure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +146,12 @@ func (h *HttpAcmeProvider) saveLoginTokens() {
|
|||||||
// acme login token
|
// acme login token
|
||||||
openTokens, err := os.Create(h.tokenFile)
|
openTokens, err := os.Create(h.tokenFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Info("[Orchid] Failed to open token file:", err)
|
logger.Logger.Info("[Orchid] Failed to open token file:", "err", err)
|
||||||
}
|
}
|
||||||
defer openTokens.Close()
|
defer openTokens.Close()
|
||||||
|
|
||||||
err = yaml.NewEncoder(openTokens).Encode(AcmeLogin{Access: h.accessToken, Refresh: h.refreshToken})
|
err = yaml.NewEncoder(openTokens).Encode(AcmeLogin{Access: h.accessToken, Refresh: h.refreshToken})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Info("[Orchid] Failed to write tokens file:", err)
|
logger.Logger.Info("[Orchid] Failed to write tokens file:", "err", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ func (s *Service) renewalRoutine(wg *sync.WaitGroup) {
|
|||||||
Logger.Info("Doing quick certificate check before starting...")
|
Logger.Info("Doing quick certificate check before starting...")
|
||||||
err := s.renewalCheck()
|
err := s.renewalCheck()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logger.Info("Certificate check, should not error first try: ", err)
|
Logger.Info("Certificate check, should not error first try: ", "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ func (s *Service) renewalRoutine(wg *sync.WaitGroup) {
|
|||||||
// run a renewal check and log errors, but ignore ErrAlreadyRenewing
|
// run a renewal check and log errors, but ignore ErrAlreadyRenewing
|
||||||
err := s.renewalCheck()
|
err := s.renewalCheck()
|
||||||
if err != nil && !errors.Is(err, ErrAlreadyRenewing) {
|
if err != nil && !errors.Is(err, ErrAlreadyRenewing) {
|
||||||
Logger.Info("Certificate check, an error occurred: ", err)
|
Logger.Info("Certificate check, an error occurred: ", "err", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ func (s *Service) setupLegoClient() (*lego.Client, error) {
|
|||||||
// getDnsProvider loads a DNS challenge provider using the provided name and
|
// getDnsProvider loads a DNS challenge provider using the provided name and
|
||||||
// token
|
// token
|
||||||
func (s *Service) getDnsProvider(name, token string) (challenge.Provider, error) {
|
func (s *Service) getDnsProvider(name, token string) (challenge.Provider, error) {
|
||||||
Logger.Info("Loading dns provider: %s with token %s*****\n", name, token[:3])
|
Logger.Info("Loading dns provider", "name", name, "token", token[:3]+"*****")
|
||||||
switch name {
|
switch name {
|
||||||
case "duckdns":
|
case "duckdns":
|
||||||
return duckdns.NewDNSProviderConfig(&duckdns.Config{
|
return duckdns.NewDNSProviderConfig(&duckdns.Config{
|
||||||
|
@ -106,7 +106,7 @@ func setupPebbleTest(t *testing.T, serverTls *certgen.CertGen) (*Service, *sql.D
|
|||||||
db2, err := sql.Open("sqlite3", dbFile)
|
db2, err := sql.Open("sqlite3", dbFile)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
Logger.Info("DB File:", dbFile)
|
Logger.Info("DB File:", "db", dbFile)
|
||||||
|
|
||||||
certDir, err := os.MkdirTemp("", "orchid-certs")
|
certDir, err := os.MkdirTemp("", "orchid-certs")
|
||||||
keyDir, err := os.MkdirTemp("", "orchid-keys")
|
keyDir, err := os.MkdirTemp("", "orchid-keys")
|
||||||
|
@ -56,7 +56,7 @@ func NewApiServer(listen string, db *database.Queries, signer mjwt.Verifier, dom
|
|||||||
// query database
|
// query database
|
||||||
rows, err := db.FindOwnedCerts(context.Background())
|
rows, err := db.FindOwnedCerts(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Info("Failed after reading certificates from database: ", err)
|
logger.Logger.Info("Failed after reading certificates from database:", "err", err)
|
||||||
http.Error(rw, "Database Error", http.StatusInternalServerError)
|
http.Error(rw, "Database Error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ func NewApiServer(listen string, db *database.Queries, signer mjwt.Verifier, dom
|
|||||||
// get etld+1
|
// get etld+1
|
||||||
topFqdn, found := vUtils.GetTopFqdn(d)
|
topFqdn, found := vUtils.GetTopFqdn(d)
|
||||||
if !found {
|
if !found {
|
||||||
logger.Logger.Info("Invalid domain found: ", d)
|
logger.Logger.Info("Invalid domain found:", "domain", d)
|
||||||
http.Error(rw, "Database Error", http.StatusInternalServerError)
|
http.Error(rw, "Database Error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func checkAuthForCertificate(verify mjwt.Verifier, perm string, db *database.Que
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
apiError(rw, http.StatusInsufficientStorage, "Database error")
|
apiError(rw, http.StatusInsufficientStorage, "Database error")
|
||||||
logger.Logger.Info("[API] Failed to find certificate owner: ", err)
|
logger.Logger.Info("[API] Failed to find certificate owner:", "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user