Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalIpAddress ¶
func GetLocalIpAddress() (ipaddr []string)
GetLocalIpAddress returns all non-loopback IPv4 addresses assigned to the local machine's network interfaces.
func GetRemoteIp ¶
GetRemoteIp returns the remote client IP address from the HTTP request. It inspects the X-Forwarded-For header first (required in AWS Lambda and other reverse-proxy environments), then X-Real-IP, and finally falls back to the TCP remote address. The loopback address "::1" is normalised to "127.0.0.1". When X-Forwarded-For contains multiple addresses, the first one is returned.
Types ¶
type Health ¶
type Health struct {
Name string `json:"name,omitempty"`
Status int `json:"status,omitempty"` // status code indicating component health
}
Health represents the health status of a named service or component.
func GetHealth ¶
func GetHealth() Health
GetHealth returns a Health snapshot reflecting the current PostgreSQL connectivity status. It is intended for API health-check endpoints only; CLI processes should not call this function because the required environment variables are unavailable in that context. The returned Status field is 2 when the database is reachable and 0 when it is not.
type Version ¶
type Version struct {
Name string `json:"name,omitempty"` // Application name from the app.name environment key.
Version string `json:"version,omitempty"` // Application version from the app.version environment key.
Environment string `json:"environment,omitempty"` // Runtime environment (e.g. production, staging) from app.env.value.
GoVersion string `json:"goVersion,omitempty"` // Go toolchain version used to build the binary.
BuildInfo string `json:"buildInfo,omitempty"` // Module version from the embedded build info.
}
Version holds application version and build metadata typically returned by a version API endpoint.
func GetVersion ¶
func GetVersion() Version
GetVersion returns a Version struct populated from the application environment configuration and the embedded Go build info. It is intended for use by API version endpoints; CLI processes may not have the required environment variables set.