Documentation ¶
Index ¶
Constants ¶
const ( PortEnv = "ERGO_PORT" DomainEnv = "ERGO_DOMAIN" VerboseEnv = "ERGO_VERBOSE" ConfigFileEnv = "ERGO_CONFIG_FILE" PortDefault = "2000" DomainDefault = ".dev" ConfigFilePathDefault = "./.ergo" )
Defines the name of ergo env variable for configuration.
Variables ¶
This section is empty.
Functions ¶
func AddService ¶ added in v0.2.0
AddService adds new service to the filepath
func NewErgoProxy ¶
func NewErgoProxy(config *Config) *httputil.ReverseProxy
NewErgoProxy returns the new reverse proxy.
func RemoveService ¶ added in v0.2.2
RemoveService removes a service from the filepath
func ServeProxy ¶ added in v0.0.5
ServeProxy listens & serves the HTTP proxy.
Types ¶
type Config ¶
type Config struct { Port string Domain string Verbose bool Services map[string]Service ConfigFile string // contains filtered or unexported fields }
Config holds the configuration for the proxy.
func (*Config) AddService ¶ added in v0.2.2
AddService add a service using the correct key
func (*Config) GetProxyPacURL ¶ added in v0.2.2
GetProxyPacURL returns the correct url for the pac file
func (*Config) GetService ¶
GetService gets the service for the given host.
func (*Config) LoadServices ¶ added in v0.2.2
LoadServices loads the services from filepath, returns an error if the configuration could not be parsed
func (*Config) OverrideBy ¶ added in v0.2.3
OverrideBy makes sure that it sets the correct config based on the defaults and the passed by argument
func (*Config) WatchConfigFile ¶ added in v0.2.2
WatchConfigFile listen for file changes and updates the config services
type Service ¶
Service holds the details of the service (Name and URL)
func NewService ¶ added in v0.2.0
NewService creates a new service from a name and a URL
func UnsafeNewService ¶ added in v0.3.1
UnsafeNewService creates a new service from a name and a URL without checking if the URL is valid. Must only be used in tests
func (Service) GetOriginalURL ¶ added in v0.3.1
GetOriginalURL returns the original URL of the service
func (Service) GetServiceURL ¶ added in v0.3.1
GetServiceURL returns the local URL to be used by the proxy server to redirect all request to the service