roadrunner: github.com/spiral/roadrunner/service/headers Index | Files

package headers

import "github.com/spiral/roadrunner/service/headers"

Index

Package Files

config.go service.go

Constants

const ID = "headers"

ID contains default service name.

type CORSConfig Uses

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
}

CORSConfig headers configuration.

type Config Uses

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
}

Config declares headers service configuration.

func (*Config) Hydrate Uses

func (c *Config) Hydrate(cfg service.Config) error

Hydrate service config.

type Service Uses

type Service struct {
    // contains filtered or unexported fields
}

Service serves headers files. Potentially convert into middleware?

func (*Service) Init Uses

func (s *Service) Init(cfg *Config, r *rrhttp.Service) (bool, error)

Init must return configure service and return true if service hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.

Package headers imports 4 packages (graph) and is imported by 3 packages. Updated 2020-04-06. Refresh now. Tools for package owners.