Documentation ¶
Overview ¶
Package handlers exports the Map and Proxy handlers, that can be imported by thirdd party packages to augment gcs-helper's behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct { Timeout time.Duration `envconfig:"GCS_CLIENT_TIMEOUT" default:"2s"` IdleConnTimeout time.Duration `envconfig:"GCS_CLIENT_IDLE_CONN_TIMEOUT" default:"120s"` MaxIdleConns int `envconfig:"GCS_CLIENT_MAX_IDLE_CONNS" default:"10"` Credentials *google.Credentials }
ClientConfig contains configuration for the GCS client communication.
It contains options related to timeouts and keep-alive connections.
func (ClientConfig) HTTPClient ¶
func (c ClientConfig) HTTPClient() (*http.Client, error)
HTTPClient returns an HTTP client with the proper authentication config (using Google's default application credentials) and timeouts.
type Config ¶
type Config struct { Listen string `default:":8080"` BucketName string `envconfig:"BUCKET_NAME" required:"true"` LogLevel string `envconfig:"LOG_LEVEL" default:"debug"` Client ClientConfig Map MapConfig Proxy ProxyConfig }
Config represents the gcs-helper configuration that is loaded from the environment.
func LoadConfig ¶
LoadConfig loads the configuration from environment variables.
type MapConfig ¶
type MapConfig struct { Endpoint string `envconfig:"GCS_HELPER_MAP_PREFIX"` RegexFilter string `envconfig:"GCS_HELPER_MAP_REGEX_FILTER"` }
MapConfig contains configuration for the map mode.
type ProxyConfig ¶
type ProxyConfig struct { Endpoint string `envconfig:"GCS_HELPER_PROXY_PREFIX"` LogHeaders []string `envconfig:"GCS_HELPER_PROXY_LOG_HEADERS"` Timeout time.Duration `envconfig:"GCS_HELPER_PROXY_TIMEOUT" default:"10s"` BucketOnPath bool `envconfig:"GCS_HELPER_PROXY_BUCKET_ON_PATH"` }
ProxyConfig contains configuration for the proxy mode.