run starts the imgproxy server
(ctx context.Context, cmd *cli.Command)
| 22 | |
| 23 | // run starts the imgproxy server |
| 24 | func 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 | |
| 50 | func main() { |
| 51 | cmd := &cli.Command{ |
nothing calls this directly
no test coverage detected