diff options
author | Wolfy-J <[email protected]> | 2019-06-24 13:35:04 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-06-24 13:35:04 +0300 |
commit | 5dc7dd6b231ccea05ffbec0df47ecaa866192308 (patch) | |
tree | 7959b582590bfbe15205480e64de2f14de2d6b47 /service/headers/config.go | |
parent | 464baf2eb7bd87ed80332280e8f73faa2d495746 (diff) |
polishing fastcgi integration, polishing headers service (splitted from http)
Diffstat (limited to 'service/headers/config.go')
-rw-r--r-- | service/headers/config.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/service/headers/config.go b/service/headers/config.go new file mode 100644 index 00000000..bb7a6b2b --- /dev/null +++ b/service/headers/config.go @@ -0,0 +1,41 @@ +package headers + +import "github.com/spiral/roadrunner/service" + +// Config declares headers service configuration. +type Config struct { + // CORS settings. + CORS *CORSConfig + + // Request headers to add to every payload send to PHP. + Request map[string]string + + // Response headers to add to every payload generated by PHP. + Response map[string]string +} + +// CORS headers configuration. +type CORSConfig struct { + // AllowedOrigin: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin + AllowedOrigin string + + // AllowedHeaders: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers + AllowedHeaders string + + // AllowedMethods: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods + AllowedMethods string + + // AllowCredentials https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials + AllowCredentials *bool + + // ExposeHeaders: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers + ExposedHeaders string + + // MaxAge of CORS headers in seconds/ + MaxAge int +} + +// Hydrate service config. +func (c *Config) Hydrate(cfg service.Config) error { + return cfg.Unmarshal(c) +} |