Documentation ¶
Overview ¶
Package server is the api-gateway server, handling all its requests with a HTTP server. Call NewServer to get a new server.Server instance, and Use Server.Listen to listen and serve the server on a port. Configuration is done using environment variables: GW_PORT: Port on which the server would listen.
default: 8080
GW_AUTH_URL: The url of the authentication service to redirect the user to authenticate.
default: "http://localhost/auth/login"
GW_DOCS_URL: The url of the edit docs.
default: "http://localhost/3000/api/files"
GW_SECRET: The secret used to validate authorization jwt tokens.
default: "pandora@drive"
GW_UPLOAD_SERVICE: The address of the upload-service.
default: "upload-service:8080"
GW_DOWNLOAD_SERVICE: The address of the download-service.
default: "download-service:8080"
GW_FILE_SERVICE: The address of the file-service.
default: "file-service:8080"
GW_EXTERNAL_APM_URL: External server's client APM url.
default: "http://localhost:8200"
GW_ALLOW_ORIGINS: List of allowed origins for the Access-Control-Allow-Origin header.
default: "http://localhost*", can be a list of urls.
For configuring the APM agent see https://www.elastic.co/guide/en/apm/agent/go/current/configuration.html For configuring the logger of the server see Package logger doc.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMetricsLogger ¶
func NewMetricsLogger() gin.HandlerFunc
NewMetricsLogger initializes the metrics middleware.
Types ¶
type ExternalNetworkDest ¶
type ExternalNetworkDest struct { Label string `json:"label"` Value string `json:"value"` AppID string `json:"appID"` ApprovalURL string `json:"approvalUrl"` ApprovalUIURL string `json:"approvalUIUrl"` IsDefault bool `json:"isDefault"` IsEnabled bool `json:"isEnabled"` IsOnlyApprover bool `json:"isOnlyApprover"` }
ExternalNetworkDest configuration of external network
func GetExternalNetworksConfiguration ¶
func GetExternalNetworksConfiguration() []ExternalNetworkDest
GetExternalNetworksConfiguration get network object configuration
type Health ¶
type Health int32
Health is an atomic Boolean Its methods are all atomic, thus safe to be called by multiple goroutines simultaneously Note: When embedding into a struct, one should always use *Health to avoid copy
func NewHealthChecker ¶
func NewHealthChecker() *Health
NewHealthChecker creates a new Health with default to false
func (*Health) Check ¶
func (h *Health) Check( interval int, rpcTimeout int, logger *logrus.Logger, gotenberg *gotenberg.Client, badConns chan<- *grpcPoolTypes.ConnPool, nonFatalConns []*grpcPoolTypes.ConnPool, fatalConns ...*grpcPoolTypes.ConnPool)
Check checks healthiness of conns once in interval seconds.
func (*Health) SetToIf ¶
SetToIf sets the Boolean to new only if the Boolean matches the old Returns whether the set was done
func (*Health) SetUnhealthy ¶
func (h *Health) SetUnhealthy()
SetUnhealthy sets the Boolean to false