hocoosmiddleware

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

caddy-middleware

Build

xcaddy build --output ./caddy.exe --with github.com/liornabat/hocoos-middleware@v0.1.0

Example

{
  "logging": {
    "logs": {
      "default": {
        "level": "DEBUG"
      }
    }
  },
  "apps": {
    "http": {
      "servers": {
        "myserver": {
          "listen": [":443",":80"],
          "routes": [
            {
              "match": [{"path": ["/*"]}],
              "handle": [
                {
                  "handler": "hocoos_middleware",
                  "redis_url": "redis://username:password@localhost:6379/0",
                  "cache_ttl": 60,
                  "exclude_hosts": "hocoos.cafe,hocoos.com,localhost"
                },
                {
                "handler": "static_response",
                "status_code": "",
                "body": "Hi there!",
                "close": false,
                "abort": false
                }
              ]
            }
          ]
        }
      }
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HocoosMiddleware

type HocoosMiddleware struct {
	RedisURL     string `json:"redis_url"`
	PathPrefix   string `json:"path_prefix"`
	CacheTTL     int    `json:"cache_ttl"`
	ExcludeHosts string `json:"exclude_hosts"`
	// contains filtered or unexported fields
}

func (*HocoosMiddleware) CaddyModule

func (m *HocoosMiddleware) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*HocoosMiddleware) Provision

func (m *HocoosMiddleware) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (*HocoosMiddleware) ServeHTTP

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*HocoosMiddleware) UnmarshalCaddyfile

func (m *HocoosMiddleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*HocoosMiddleware) Validate

func (m *HocoosMiddleware) Validate() error

Validate implements caddy.Validator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL