generators

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const WireguardTemplate = `` /* 418-byte string literal not displayed */

Variables

This section is empty.

Functions

func AskApacheUseTLS added in v1.4.0

func AskApacheUseTLS() bool

func AskDomain

func AskDomain() string

AskDomain asks for the main domain (shared)

func AskEnvFile

func AskEnvFile() string

AskEnvFile asks for environment file

func AskEnvironmentVariables

func AskEnvironmentVariables() map[string]string

AskEnvironmentVariables asks for environment variables

func AskGenerateCerts added in v1.2.0

func AskGenerateCerts() bool

AskGenerateCerts asks if we should generate certs with mkcert (shared)

func AskNumberOfRoutes

func AskNumberOfRoutes() int

AskNumberOfRoutes asks how many routes to configure (shared)

func AskNumberOfServices

func AskNumberOfServices() int

AskNumberOfServices asks how many services to configure

func AskPorts

func AskPorts() []string

AskPorts asks for port mappings

func AskTLS added in v1.3.0

func AskTLS(domain, defaultCertPath string) (bool, string)

AskTLS asks if using TLS and optionally where certs live. Returns (useTLS, certPath). Pass a sensible defaultCertPath (without suffix) like "/etc/nginx/certs/example.com".

func AskVolumes

func AskVolumes() []string

AskVolumes asks for volume mounts

func GenerateApacheConfig added in v1.4.0

func GenerateApacheConfig()

GenerateApacheConfig manages the entire Apache interactive flow

func GenerateCaddyConfig added in v1.3.0

func GenerateCaddyConfig()

GenerateCaddyConfig manages the interactive flow

func GenerateCerts added in v1.2.0

func GenerateCerts(domain, outDir string) error

GenerateCerts runs mkcert to produce cert and key for domain into outDir (shared)

func GenerateDockerCompose

func GenerateDockerCompose()

GenerateDockerCompose manages the entire Docker Compose interactive flow

func GenerateNginxConfig

func GenerateNginxConfig()

GenerateNginxConfig manages the entire Nginx interactive flow

func GenerateWireGuardConfig added in v1.1.0

func GenerateWireGuardConfig(mode string)

func HandleApache added in v1.4.0

func HandleApache(command string)

func HandleCaddy added in v1.3.0

func HandleCaddy(command string)

HandleCaddy manages caddy commands

func HandleDocker

func HandleDocker(command string)

HandleDocker manages all docker commands

func HandleNginx

func HandleNginx(command string)

HandleNginx manages all nginx commands

func HandleWireGuard added in v1.1.0

func HandleWireGuard(args []string)

HandleWireGuard manages all WireGuard commands

func NormalizeOutputPath

func NormalizeOutputPath(filename string) (string, error)

NormalizeOutputPath normalizes an output filename provided by the user. - treats leading "/build/" as the repo-local "./build/" directory - expands leading ~ to the user's home directory - ensures parent directories exist

func PrintApacheHelp added in v1.4.0

func PrintApacheHelp()

func PrintCaddyHelp added in v1.3.0

func PrintCaddyHelp()

PrintCaddyHelp shows help for Caddy

func PrintDockerHelp

func PrintDockerHelp()

PrintDockerHelp shows help for Docker

func PrintNginxHelp

func PrintNginxHelp()

PrintNginxHelp shows help for Nginx

func PrintWireGuardHelp added in v1.1.0

func PrintWireGuardHelp()

PrintWireGuardHelp shows help for WireGuard

func WriteApacheConfig added in v1.4.0

func WriteApacheConfig(config Apache, filename string) error

func WriteCaddyConfig added in v1.3.0

func WriteCaddyConfig(config CaddyfileConfig, filename string) error

WriteCaddyConfig writes the Caddyfile to a file

func WriteDockerCompose

func WriteDockerCompose(config DockerComposeConfig, filename string) error

WriteDockerCompose writes the docker-compose configuration to a file

func WriteNginxConfig

func WriteNginxConfig(config NginxConfig, filename string) error

WriteNginxConfig writes the configuration to a file

func WriteWireGuardConfig added in v1.1.0

func WriteWireGuardConfig(config WireGuardConfig) error

Types

type Apache added in v1.4.0

type Apache struct {
	Domain   string
	UseTLS   bool
	CertPath string
	Routes   []ApacheRoute
}

type ApacheRoute added in v1.4.0

type ApacheRoute struct {
	Type      string
	Path      string
	Proxy     string
	Directory string
}

func AskRouteApache added in v1.4.0

func AskRouteApache(routeNumber int) ApacheRoute

type CaddyRoute added in v1.3.0

type CaddyRoute struct {
	Path      string // "/" or "/api/*"
	Type      string // "proxy" or "static"
	Proxy     string // "localhost:3000"
	Directory string // "/var/www/html"
	Headers   bool   // Add standard headers
}

CaddyRoute represents a path in Caddy

func AskRouteCaddy added in v1.3.0

func AskRouteCaddy(routeNumber int) CaddyRoute

AskRouteCaddy asks for details of a single route

type CaddyfileConfig added in v1.3.0

type CaddyfileConfig struct {
	Domain   string
	UseTLS   bool
	CertPath string
	Routes   []CaddyRoute
}

CaddyConfig is the complete Caddy configuration

type DockerComposeConfig

type DockerComposeConfig struct {
	Version  string
	Services []DockerService
}

DockerComposeConfig is the complete docker-compose configuration

type DockerService

type DockerService struct {
	Name        string            // "web", "db", "redis"
	Image       string            // "nginx:latest", "postgres:15"
	Ports       []string          // ["8080:80", "5432:5432"]
	Volumes     []string          // ["/data:/var/lib/postgresql/data"]
	Environment map[string]string // {"POSTGRES_PASSWORD": "secret"}
	EnvFile     string            // ".env.db" or ".env"
}

DockerService represents a single Docker service

func AskService

func AskService(serviceNumber int) DockerService

AskService asks for details of a single Docker service

type NginxConfig

type NginxConfig struct {
	Domain   string
	UseHTTPS bool
	Routes   []Route
	// CertPath is the path (on the nginx host) without suffix; template will append .crt/.key
	CertPath string
}

NginxConfig is the complete Nginx configuration

type Route

type Route struct {
	Path      string // "/" or "/api"
	Type      string // "proxy" or "static"
	Proxy     string // "localhost:3000"
	Directory string // "/var/www/html"
	Headers   bool   // Add standard headers
	WebSocket bool   // Support WebSockets (for proxy)
}

Route represents a path in Nginx

func AskRoute

func AskRoute(routeNumber int) Route

Note: shared prompt helpers were moved to generators/promptutils.go AskRoute asks for details of a single route

type WireGuardConfig added in v1.1.0

type WireGuardConfig struct {
	InterfaceName string // "wg0"
	PrivateKey    string
	Address       string // 10.0.0.1/24
	DNS           string // 8.8.8.8
	ListenPort    string // 51820
	Peers         []WireGuardPeer
}

type WireGuardPeer added in v1.1.0

type WireGuardPeer struct {
	PublicKey           string // ask for public key of the peer
	AllowedIPs          string // 10.0.0.2/32
	Endpoint            string // 192.168.1.1:51820 if is client, empty if is server
	PersistentKeepalive string // 25
}

Jump to

Keyboard shortcuts

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