Fix small nbf->naf bug in db.CreateOrder

- still needs unit test
pull/496/head
max furman 3 years ago
parent a785131d09
commit fd447c5b54

@ -3,6 +3,7 @@ package nosql
import (
"context"
"encoding/json"
"fmt"
"sync"
"time"
@ -91,9 +92,10 @@ func (db *DB) CreateOrder(ctx context.Context, o *acme.Order) error {
ExpiresAt: o.ExpiresAt,
Identifiers: o.Identifiers,
NotBefore: o.NotBefore,
NotAfter: o.NotBefore,
NotAfter: o.NotAfter,
AuthorizationIDs: o.AuthorizationIDs,
}
fmt.Printf("dbo = %+v\n", dbo)
if err := db.save(ctx, o.ID, dbo, nil, "order", orderTable); err != nil {
return err
}

@ -1,6 +1,7 @@
package acme
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
@ -337,3 +338,12 @@ func (e *Error) Cause() error {
}
return e.Err
}
// ToLog implements the EnableLogger interface.
func (e *Error) ToLog() (interface{}, error) {
b, err := json.Marshal(e)
if err != nil {
return nil, WrapErrorISE(err, "error marshaling acme.Error for logging")
}
return string(b), nil
}

@ -33,11 +33,15 @@ func WriteError(w http.ResponseWriter, err error) {
// Write errors in the response writer
if rl, ok := w.(logging.ResponseLogger); ok {
logErr := err
if u, ok := err.(*acme.Error); ok {
logErr = u.Err
}
rl.WithFields(map[string]interface{}{
"error": err,
"error": logErr,
})
if os.Getenv("STEPDEBUG") == "1" {
if e, ok := err.(errs.StackTracer); ok {
if e, ok := logErr.(errs.StackTracer); ok {
rl.WithFields(map[string]interface{}{
"stack-trace": fmt.Sprintf("%+v", e),
})

Loading…
Cancel
Save