Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const Namespace = "github_com/devopsfaith/krakend-httpsecure"
Namespace is the key to use to store and access the custom config data
Variables ¶
View Source
var ZeroCfg = secure.Options{}
ZeroCfg is the zero value for the Config struct. Deprecated: the config getter does not return a ZeroCfg when no config available
Functions ¶
func ConfigGetter ¶
func ConfigGetter(e config.ExtraConfig) interface{}
ConfigGetter implements the config.ConfigGetter interface. It parses the extra config for the package and returns nil if something goes wrong.
Example ¶
cfg := ConfigGetter(config.ExtraConfig{ Namespace: map[string]interface{}{ "allowed_hosts": []interface{}{"host1"}, "host_proxy_headers": []interface{}{"x-custom-header"}, "sts_seconds": 10.0, "ssl_redirect": true, "ssl_host": "secure.example.com", }, }) fmt.Println(cfg)
Output: {false false false false false false true false false false false secure.example.com [host1] [x-custom-header] <nil> map[] 10 }
Example (FromParsedData) ¶
sample := `{ "allowed_hosts": ["host1"], "ssl_proxy_headers": {}, "sts_seconds": 300, "frame_deny": true, "sts_include_subdomains": true }` parsedCfg := map[string]interface{}{} if err := json.Unmarshal([]byte(sample), &parsedCfg); err != nil { fmt.Println(err) return } cfg := ConfigGetter(config.ExtraConfig{Namespace: parsedCfg}) fmt.Println(cfg)
Output: {false false false true false false false false false true false [host1] [] <nil> map[] 300 }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.