mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 20:02:15 +01:00
rolling back from previous implementation, now using master version of unoconv
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/thecodingmachine/gotenberg/internal/app/xhttp/pkg/resource"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/conf"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/normalize"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/prinery"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/xerror"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/xlog"
|
||||
)
|
||||
@@ -23,23 +22,16 @@ type Context struct {
|
||||
echo.Context
|
||||
logger xlog.Logger
|
||||
config conf.Config
|
||||
prinry prinery.Prinery
|
||||
resource resource.Resource
|
||||
startTime time.Time
|
||||
}
|
||||
|
||||
// New creates a new Context.
|
||||
func New(
|
||||
c echo.Context,
|
||||
logger xlog.Logger,
|
||||
config conf.Config,
|
||||
prinry prinery.Prinery,
|
||||
) Context {
|
||||
func New(c echo.Context, logger xlog.Logger, config conf.Config) Context {
|
||||
return Context{
|
||||
c,
|
||||
logger,
|
||||
config,
|
||||
prinry,
|
||||
resource.Resource{},
|
||||
time.Now(),
|
||||
}
|
||||
@@ -78,29 +70,6 @@ func (ctx Context) Config() conf.Config {
|
||||
return ctx.config
|
||||
}
|
||||
|
||||
// ProcessesHealthcheck returns an error if
|
||||
// one of the processes is not viable.
|
||||
func (ctx Context) ProcessesHealthcheck() error {
|
||||
const op string = "context.Context.ProcessesHealthcheck"
|
||||
// TODO
|
||||
/*processes := ctx.manager.All()
|
||||
for _, p := range processes {
|
||||
if !ctx.manager.IsViable(p) {
|
||||
return xerror.New(
|
||||
op,
|
||||
fmt.Errorf("'%s' is not viable", p.ID()),
|
||||
)
|
||||
}
|
||||
}*/
|
||||
return nil
|
||||
}
|
||||
|
||||
// Prinery returns the instance of prinery.Prinery
|
||||
// associated with the Context.
|
||||
func (ctx Context) Prinery() prinery.Prinery {
|
||||
return ctx.prinry
|
||||
}
|
||||
|
||||
// WithResource creates a resource.Resource and
|
||||
// adds it to the Context.
|
||||
func (ctx *Context) WithResource(directoryName string) error {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/conf"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/pm2"
|
||||
"github.com/thecodingmachine/gotenberg/test"
|
||||
)
|
||||
|
||||
@@ -27,27 +26,6 @@ func TestMustCastFromEchoContext(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestProcessesHealthcheck(t *testing.T) {
|
||||
// process is viable.
|
||||
ctx := New(
|
||||
test.DummyEchoContext(),
|
||||
test.DebugLogger(),
|
||||
conf.DefaultConfig(),
|
||||
pm2.NewDummyProcess(true),
|
||||
)
|
||||
err := ctx.ProcessesHealthcheck()
|
||||
assert.Nil(t, err)
|
||||
// process is not viable.
|
||||
ctx = New(
|
||||
test.DummyEchoContext(),
|
||||
test.DebugLogger(),
|
||||
conf.DefaultConfig(),
|
||||
pm2.NewDummyProcess(false),
|
||||
)
|
||||
err = ctx.ProcessesHealthcheck()
|
||||
test.AssertError(t, err)
|
||||
}
|
||||
|
||||
func TestLogRequestResult(t *testing.T) {
|
||||
ctx := New(
|
||||
test.DummyEchoContext(),
|
||||
|
||||
@@ -76,34 +76,6 @@ func ArgKeys() []ArgKey {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
WaitTimeoutAndWaitDelayArg is a helper for retrieving
|
||||
the sum of "waitTimeout" and "waitDelay" arguments
|
||||
as float64.
|
||||
|
||||
It also validates them against the application
|
||||
configuration.
|
||||
*/
|
||||
func WaitTimeoutAndWaitDelayArg(r Resource, config conf.Config) (float64, error) {
|
||||
const op string = "resource.WaitTimeoutAndWaitDelayArg"
|
||||
resolver := func() (float64, error) {
|
||||
waitTimeout, err := WaitTimeoutArg(r, config)
|
||||
if err != nil {
|
||||
return waitTimeout, err
|
||||
}
|
||||
waitDelay, err := WaitDelayArg(r, config)
|
||||
if err != nil {
|
||||
return waitDelay, err
|
||||
}
|
||||
return waitTimeout + waitDelay, nil
|
||||
}
|
||||
combined, err := resolver()
|
||||
if err != nil {
|
||||
return combined, xerror.New(op, err)
|
||||
}
|
||||
return combined, nil
|
||||
}
|
||||
|
||||
/*
|
||||
WaitTimeoutArg is a helper for retrieving
|
||||
the "waitTimeout" argument as float64.
|
||||
|
||||
Reference in New Issue
Block a user