Documentation
¶
Index ¶
- Constants
- func EnsurePortIsFree(port int, log logger.Logger)
- func GracefulShutdown(server *http.Server, pidFile string, log logger.Logger)
- func IsPortBusy(port int) (bool, int, error)
- func LogFileName(prefix string) string
- func ReadPID(pidFile string) (int, error)
- func RemovePID(pidFile string) error
- func SendSIGTERM(pid int) error
- func ShutdownServer(configPath string, log logger.Logger) error
- func WaitForPortFreed(port int, log logger.Logger)
- func WritePID(pidFile string) error
- type Config
- type DomainFile
- type DomainRule
Constants ¶
View Source
const DefaultPort = 2026
Variables ¶
This section is empty.
Functions ¶
func EnsurePortIsFree ¶
EnsurePortIsFree prüft, ob der Port frei ist. Falls nicht, wird der Prozess per Port-Suche gekillt und gewartet, bis der Port frei ist.
func GracefulShutdown ¶
GracefulShutdown wartet immer selbst auf SIGTERM/SIGINT und loggt das Signal.
func IsPortBusy ¶
IsPortBusy prüft, ob der Port bereits belegt ist. Gibt ggf. die PID des Prozesses zurück (immer 0, da Go das nicht nativ unterstützt).
func LogFileName ¶
LogFileName returns a log file name based on the current datetime (YYYYMMDD_HHMMSS.log)
func SendSIGTERM ¶
func WaitForPortFreed ¶
WaitForPortFreed wartet, bis der Port nicht mehr belegt ist (Timeout: 10s)
Types ¶
type Config ¶
type Config struct {
Port int `json:"port"`
PidFile string `json:"pid_file"`
DomainFiles []string `json:"domain_files,omitempty"`
}
func LoadConfig ¶
type DomainFile ¶
type DomainFile struct {
Name string `json:"name"`
Description string `json:"description"`
Rules []DomainRule `json:"rules"`
}
type DomainRule ¶
Click to show internal directories.
Click to hide internal directories.