Make 'URLPathTransformer' interface and implementation to do the function prefix trimming instead of baking it in. Also add a configuration option, 'pass_url_path_to_functions' to control whether the full path is passed to the functions or not.

Signed-off-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
Thomas E Lackey
2018-08-13 23:00:16 -05:00
committed by Alex Ellis
parent 7870b87c38
commit decf9addb3
6 changed files with 85 additions and 33 deletions

View File

@ -105,6 +105,8 @@ func (ReadConfig) Read(hasEnv HasEnv) GatewayConfig {
cfg.DirectFunctions = parseBoolValue(hasEnv.Getenv("direct_functions"))
cfg.DirectFunctionsSuffix = hasEnv.Getenv("direct_functions_suffix")
cfg.PassURLPathsToFunctions = parseBoolValue(hasEnv.Getenv("pass_url_path_to_functions"))
cfg.UseBasicAuth = parseBoolValue(hasEnv.Getenv("basic_auth"))
secretPath := hasEnv.Getenv("secret_mount_path")
@ -150,6 +152,10 @@ type GatewayConfig struct {
// If set this will be used to resolve functions directly
DirectFunctionsSuffix string
// If set to true, the requested path will be passed along to the function, minus the "/function/xyz"
// prefix, else the path will be truncated to "/" regardless of what the client sends.
PassURLPathsToFunctions bool
// If set, reads secrets from file-system for enabling basic auth.
UseBasicAuth bool