class

Detector::Specification::Nginx

Inherits Detector < Reference < Object

Constants

INCLUDE_RE = /^\s*include\s+\S+\s*;/
LOCATION_RE = /^\s*location\s+(?:(?:=|~\*|~|\^~)\s+)?\S+/
SERVER_RE = /^\s*server\s*(?:\{|$)/

A server block whose locations all sit in included files.

SHAPE_GUARD = /location|include|\{\{/

Whole-content necessary-condition guard for nginx_shape?: a line can only match LOCATION_RE if "location" appears in the raw content — or if a template action is spliced out of the middle of the word (loc{{x}}ation), which the \{\{ disjunct keeps on the slow path. Comment stripping only truncates lines, so it can never assemble the keyword (nor include, for INCLUDE_RE). Skips the per-line walk for the vast majority of .conf / .tmpl files that carry no location block.

Instance methods

applicable?(filename : String) : Bool

Registers each Nginx config path in CodeLocator.

.conf is by far the most common extension for Nginx fragments; .tmpl/.template files are common in docker-gen and deployment repositories that render Nginx configs from templates.

Source
detect(filename : String, file_contents : String) : Bool
Source
idempotent?

Registers each Nginx config path in CodeLocator.

.conf is by far the most common extension for Nginx fragments; .tmpl/.template files are common in docker-gen and deployment repositories that render Nginx configs from templates.

Source
name

Registers each Nginx config path in CodeLocator.

.conf is by far the most common extension for Nginx fragments; .tmpl/.template files are common in docker-gen and deployment repositories that render Nginx configs from templates.

Source