Help us shape the future of Go! Take the 2026 Go Developer Survey

nginxtopo

package
v1.4.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 3 Imported by: 0

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

View Source
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

View Source
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

func ResolveFrontingDir(projectDir, frontedBy string) (dir string, ok bool)

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

func ServedNginxDir(projectDir, frontedBy string) (string, error)

ServedNginxDir returns the served stack's nginx directory (the parent of sites/ and conf.d/): <ServedRoot>/nginx.

func ServedRoot added in v1.4.13

func ServedRoot(projectDir, frontedBy string) (string, error)

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

func ServedSSLDir(projectDir, frontedBy string) (string, error)

ServedSSLDir returns the served stack's ssl directory (the one mounted at /etc/nginx/ssl): <ServedRoot>/ssl.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL