MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / run

Function run

cli/main.go:24–48  ·  view source on GitHub ↗

run starts the imgproxy server

(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

22
23// run starts the imgproxy server
24func run(ctx context.Context, cmd *cli.Command) error {
25 if err := imgproxy.Init(ctx); err != nil {
26 return err
27 }
28 defer imgproxy.Shutdown()
29
30 cfg, err := imgproxy.LoadConfigFromEnv(nil)
31 if err != nil {
32 return err
33 }
34
35 ctx, _ = signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)
36
37 instance, err := imgproxy.New(ctx, cfg)
38 if err != nil {
39 return err
40 }
41 defer instance.Close(ctx)
42
43 if err := instance.StartServer(ctx, nil); err != nil {
44 return err
45 }
46
47 return nil
48}
49
50func main() {
51 cmd := &cli.Command{

Callers

nothing calls this directly

Calls 3

ShutdownMethod · 0.80
CloseMethod · 0.65
StartServerMethod · 0.45

Tested by

no test coverage detected