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

Function New

options/parser/parser.go:12–31  ·  view source on GitHub ↗

New creates new Parser instance

(ctx context.Context, config *Config)

Source from the content-addressed store, hash-verified

10
11// New creates new Parser instance
12func New(ctx context.Context, config *Config) (*Parser, error) {
13 if err := config.Validate(); err != nil {
14 return nil, err
15 }
16
17 p := &Parser{
18 config: config,
19 presets: make(map[string][]urlOption),
20 }
21
22 if err := p.parsePresets(); err != nil {
23 return nil, err
24 }
25
26 if err := p.validatePresets(ctx); err != nil {
27 return nil, err
28 }
29
30 return p, nil
31}
32
33func (p *Parser) IsSecurityOptionsAllowed(ctx context.Context) error {
34 if p.config.AllowSecurityOptions {

Callers

nothing calls this directly

Calls 3

parsePresetsMethod · 0.95
validatePresetsMethod · 0.95
ValidateMethod · 0.45

Tested by

no test coverage detected