Documentation
¶
Overview ¶
Package nginxtopo resolves on-disk nginx directory topology for projects fronted by another stack's nginx (NGINX_FRONTED_BY / config.NginxConfig. FrontedBy). It has no dependency on internal/config, internal/build, or internal/doctor so any of them can import it without a cycle.
Index ¶
Constants ¶
const NginxSSLContainerPath = "/etc/nginx/ssl"
ssl_path.go — the one in-container path both the nginx conf generator and the compose service definition must agree on for TLS to actually start.
Purpose: a production box was found with generated nginx confs referencing "/etc/nginx/ssl/certificates/local-nself-org/..." — the generator's literal was correct in isolation, but it and the compose volume mount target ("./ssl:/etc/nginx/ssl:ro") were two independently hand-typed string literals in two different packages (internal/nginx, internal/compose) with nothing forcing them to agree. NginxSSLContainerPath lives here — a package with zero internal dependencies, so both can import it without a cycle — as the single place either would need to change. Inputs: none (a constant). Outputs: NginxSSLContainerPath, the absolute in-container directory nginx's TLS material is mounted at. Constraints: this is the MOUNT TARGET only. The certificate subdirectory name under "<NginxSSLContainerPath>/certificates/" is a second, separate question — see internal/ssl.DomainToDirName, the one implementation of domain-to-directory-name both internal/ssl (which writes the certs) and internal/nginx (which references them) now share.
Variables ¶
var ErrFrontingUnresolved = errors.New("cannot resolve the served nginx stack")
ErrFrontingUnresolved is returned (wrapped) when NGINX_FRONTED_BY is set but the project is not laid out directly under a directory named after the fronting stack, so the served stack cannot be located. Match with errors.Is.
Functions ¶
func ResolveFrontingDir ¶
ResolveFrontingDir resolves the directory of the stack named by frontedBy when projectDir is laid out as a subdirectory (conventionally "backend") directly under that stack's own directory.
Example: projectDir ".../nself-web/backend" with frontedBy "nself-web" resolves to ".../nself-web" — the fronting stack's own root. Callers append their own "nginx/..." subpath (e.g. "nginx/sites") to that root.
func ServedNginxDir ¶ added in v1.4.13
ServedNginxDir returns the served stack's nginx directory (the parent of sites/ and conf.d/): <ServedRoot>/nginx.
func ServedRoot ¶ added in v1.4.13
ServedRoot returns the project directory of the stack whose nginx serves this project: projectDir itself when frontedBy is empty, otherwise the fronting stack's directory as confirmed by ResolveFrontingDir. An unconfirmed layout returns "" and an error wrapping ErrFrontingUnresolved.
func ServedSSLDir ¶ added in v1.4.13
ServedSSLDir returns the served stack's ssl directory (the one mounted at /etc/nginx/ssl): <ServedRoot>/ssl.
Types ¶
This section is empty.