Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasDomainConflict ¶
func HasDomainConflict(routes []NginxRoute) (bool, []string)
HasDomainConflict detects when two or more routes share the same server_name + location combination. Returns true and a list of conflict description strings if conflicts are found.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator builds nginx configuration files from project configuration.
func NewGenerator ¶
NewGenerator creates an nginx Generator from the given config. When SSL_MODE is "local" (or empty, which defaults to "local" in dev), nginx server blocks are generated with ssl_certificate directives pointing to the locally generated cert files. For other modes (letsencrypt, custom, none), the HTTPS server blocks are omitted so nginx can start without requiring cert files that do not yet exist.
func (*Generator) Generate ¶
Generate produces all nginx config files. Returns map of filepath to content (relative to project root).
func (*Generator) RenderServiceRoute ¶
func (g *Generator) RenderServiceRoute(data ServiceRouteData) (string, error)
RenderServiceRoute renders a single service route config from the service.conf.tmpl. Exported so external callers can render individual service routes. HasSSL in the provided data is always overridden by the generator's own hasSSL value, which is derived from SSL_MODE. Callers do not need to set it.
type NginxRoute ¶
type NginxRoute struct {
ServerName string // e.g. "auth.example.com"
Location string // e.g. "/" (always "/" in current templates)
}
NginxRoute represents a single nginx server block route for conflict detection.
type ServiceRouteData ¶
type ServiceRouteData struct {
Route string
BaseDomain string
Upstream string
SSLDir string
RateZone string
Burst int
ConnLimit int
WebSocket bool
LazyResolve bool
// HasSSL controls whether ssl_certificate directives and the listen 443
// directives are emitted. Set to false for letsencrypt/custom/none modes.
HasSSL bool
}
ServiceRouteData holds template data for service.conf.tmpl.