Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ConfigEnvPrefix is the prefix applied to environment variables for configuring Auth0. ConfigEnvPrefix = config.ConfigEnvPrefix + "REVERSEPROXY_" )
Variables ¶
View Source
var LoadConfig = sync.OnceValues(func() (*Config, error) { if err := config.Load(ConfigEnvPrefix, &cfg); err != nil { return nil, fmt.Errorf("load config: %w", err) } if os.Getenv("PORT") != "" { if port, err := strconv.ParseUint(os.Getenv("PORT"), 10, 64); err != nil { return nil, fmt.Errorf("load port from envrionment: %w", err) } else { cfg.Port = port } } if err := validation.Validate.Struct(cfg); err != nil { return nil, fmt.Errorf("google: unable to validate config: %w", err) } return &cfg, nil })
LoadConfig loads the auth0 configuration and ensures this is only done one time, no matter how many times it is called.
Functions ¶
func GenerateProxyURL ¶
GenerateProxyURL takes the given URL and generates a new URL to proxy the request through the reverse proxy service.
func IsProxiedURL ¶
IsProxiedURL returns a boolean indicating whether the given URL is being proxied through the reverse proxy. If this cannot be determined, a non-nil error is also returned and the boolean status should be ignored.
Types ¶
type Config ¶
type Config struct {
Port uint64 `koanf:"port" validate:"required,port"`
Host string `koanf:"host" validate:"required,hostname|fqdn|ip"`
Key string `koanf:"key" validate:"required,base64rawurl"`
Salt string `koanf:"salt" validate:"required,base64rawurl"`
BaseURL string `koanf:"baseurl" validate:"required,url"`
}
Config contains the reverseproxy configuration options.
Click to show internal directories.
Click to hide internal directories.