mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 02:43:35 +08:00
26 lines
681 B
Go
26 lines
681 B
Go
package main
|
|
|
|
import (
|
|
. "github.com/mickael-kerjean/nuage/server/common"
|
|
"io"
|
|
"net/http"
|
|
)
|
|
|
|
func Register(config *Config) []Plugin {
|
|
config.Get("plugins.example.foo").Default("bar")
|
|
|
|
return []Plugin{
|
|
{
|
|
Type: PROCESS_FILE_CONTENT_BEFORE_SEND, // where to hook our plugin in the request lifecycle
|
|
Call: hook, // actual function we trigger
|
|
Priority: 5, // determine execution order whilst multiple plugin type
|
|
},
|
|
}
|
|
}
|
|
|
|
func hook(file io.Reader, ctx *App, res *http.ResponseWriter, req *http.Request) (io.Reader, error){
|
|
Log.Debug("Plugin::Example")
|
|
Log.Debug("Conf: plugins.example.foo = '%s'", ctx.Config.Get("plugins.example.foo").String())
|
|
return file, nil
|
|
}
|