Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
d3860f95
Commit
d3860f95
authored
Jun 06, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make RegisterPlugin() more consistent, having name as first argument
parent
9b4134b2
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
33 additions
and
62 deletions
+33
-62
caddyhttp/basicauth/setup.go
caddyhttp/basicauth/setup.go
+1
-2
caddyhttp/bind/bind.go
caddyhttp/bind/bind.go
+1
-2
caddyhttp/browse/setup.go
caddyhttp/browse/setup.go
+1
-2
caddyhttp/errors/errors.go
caddyhttp/errors/errors.go
+1
-2
caddyhttp/expvar/setup.go
caddyhttp/expvar/setup.go
+1
-2
caddyhttp/extensions/setup.go
caddyhttp/extensions/setup.go
+1
-2
caddyhttp/fastcgi/setup.go
caddyhttp/fastcgi/setup.go
+1
-2
caddyhttp/gzip/gzip.go
caddyhttp/gzip/gzip.go
+1
-2
caddyhttp/header/setup.go
caddyhttp/header/setup.go
+1
-2
caddyhttp/internalsrv/setup.go
caddyhttp/internalsrv/setup.go
+1
-2
caddyhttp/log/log.go
caddyhttp/log/log.go
+1
-2
caddyhttp/markdown/setup.go
caddyhttp/markdown/setup.go
+1
-2
caddyhttp/mime/setup.go
caddyhttp/mime/setup.go
+1
-2
caddyhttp/pprof/setup.go
caddyhttp/pprof/setup.go
+1
-2
caddyhttp/proxy/setup.go
caddyhttp/proxy/setup.go
+1
-2
caddyhttp/redirect/setup.go
caddyhttp/redirect/setup.go
+1
-2
caddyhttp/rewrite/setup.go
caddyhttp/rewrite/setup.go
+1
-2
caddyhttp/root/root.go
caddyhttp/root/root.go
+1
-2
caddyhttp/templates/setup.go
caddyhttp/templates/setup.go
+1
-2
caddyhttp/websocket/setup.go
caddyhttp/websocket/setup.go
+1
-2
caddytls/setup.go
caddytls/setup.go
+1
-4
plugins.go
plugins.go
+10
-10
startupshutdown/startupshutdown.go
startupshutdown/startupshutdown.go
+2
-8
No files found.
caddyhttp/basicauth/setup.go
View file @
d3860f95
...
@@ -8,8 +8,7 @@ import (
...
@@ -8,8 +8,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"basicauth"
,
caddy
.
Plugin
{
Name
:
"basicauth"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/bind/bind.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"bind"
,
caddy
.
Plugin
{
Name
:
"bind"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setupBind
,
Action
:
setupBind
,
})
})
...
...
caddyhttp/browse/setup.go
View file @
d3860f95
...
@@ -11,8 +11,7 @@ import (
...
@@ -11,8 +11,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"browse"
,
caddy
.
Plugin
{
Name
:
"browse"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/errors/errors.go
View file @
d3860f95
...
@@ -16,8 +16,7 @@ import (
...
@@ -16,8 +16,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"errors"
,
caddy
.
Plugin
{
Name
:
"errors"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/expvar/setup.go
View file @
d3860f95
...
@@ -10,8 +10,7 @@ import (
...
@@ -10,8 +10,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"expvar"
,
caddy
.
Plugin
{
Name
:
"expvar"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/extensions/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"ext"
,
caddy
.
Plugin
{
Name
:
"ext"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/fastcgi/setup.go
View file @
d3860f95
...
@@ -10,8 +10,7 @@ import (
...
@@ -10,8 +10,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"fastcgi"
,
caddy
.
Plugin
{
Name
:
"fastcgi"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/gzip/gzip.go
View file @
d3860f95
...
@@ -17,8 +17,7 @@ import (
...
@@ -17,8 +17,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"gzip"
,
caddy
.
Plugin
{
Name
:
"gzip"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/header/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"header"
,
caddy
.
Plugin
{
Name
:
"header"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/internalsrv/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"internal"
,
caddy
.
Plugin
{
Name
:
"internal"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/log/log.go
View file @
d3860f95
...
@@ -11,8 +11,7 @@ import (
...
@@ -11,8 +11,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"log"
,
caddy
.
Plugin
{
Name
:
"log"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/markdown/setup.go
View file @
d3860f95
...
@@ -10,8 +10,7 @@ import (
...
@@ -10,8 +10,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"markdown"
,
caddy
.
Plugin
{
Name
:
"markdown"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/mime/setup.go
View file @
d3860f95
...
@@ -9,8 +9,7 @@ import (
...
@@ -9,8 +9,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"mime"
,
caddy
.
Plugin
{
Name
:
"mime"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/pprof/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"pprof"
,
caddy
.
Plugin
{
Name
:
"pprof"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/proxy/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"proxy"
,
caddy
.
Plugin
{
Name
:
"proxy"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/redirect/setup.go
View file @
d3860f95
...
@@ -8,8 +8,7 @@ import (
...
@@ -8,8 +8,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"redir"
,
caddy
.
Plugin
{
Name
:
"redir"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/rewrite/setup.go
View file @
d3860f95
...
@@ -10,8 +10,7 @@ import (
...
@@ -10,8 +10,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"rewrite"
,
caddy
.
Plugin
{
Name
:
"rewrite"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/root/root.go
View file @
d3860f95
...
@@ -9,8 +9,7 @@ import (
...
@@ -9,8 +9,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"root"
,
caddy
.
Plugin
{
Name
:
"root"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setupRoot
,
Action
:
setupRoot
,
})
})
...
...
caddyhttp/templates/setup.go
View file @
d3860f95
...
@@ -8,8 +8,7 @@ import (
...
@@ -8,8 +8,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"templates"
,
caddy
.
Plugin
{
Name
:
"templates"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddyhttp/websocket/setup.go
View file @
d3860f95
...
@@ -6,8 +6,7 @@ import (
...
@@ -6,8 +6,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"websocket"
,
caddy
.
Plugin
{
Name
:
"websocket"
,
ServerType
:
"http"
,
ServerType
:
"http"
,
Action
:
setup
,
Action
:
setup
,
})
})
...
...
caddytls/setup.go
View file @
d3860f95
...
@@ -16,10 +16,7 @@ import (
...
@@ -16,10 +16,7 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"tls"
,
caddy
.
Plugin
{
Action
:
setupTLS
})
Name
:
"tls"
,
Action
:
setupTLS
,
})
}
}
// setupTLS sets up the TLS configuration and installs certificates that
// setupTLS sets up the TLS configuration and installs certificates that
...
...
plugins.go
View file @
d3860f95
...
@@ -135,11 +135,6 @@ type ServerType struct {
...
@@ -135,11 +135,6 @@ type ServerType struct {
// Plugin is a type which holds information about a plugin.
// Plugin is a type which holds information about a plugin.
type
Plugin
struct
{
type
Plugin
struct
{
// The plugin must have a name: lower case and one word.
// If this plugin has an action, it must be the name of
// the directive to attach to. A name is always required.
Name
string
// ServerType is the type of server this plugin is for.
// ServerType is the type of server this plugin is for.
// Can be empty if not applicable, or if the plugin
// Can be empty if not applicable, or if the plugin
// can associate with any server type.
// can associate with any server type.
...
@@ -154,17 +149,22 @@ type Plugin struct {
...
@@ -154,17 +149,22 @@ type Plugin struct {
// themselves, even if they do not perform an action associated
// themselves, even if they do not perform an action associated
// with a directive. It is important for the process to know
// with a directive. It is important for the process to know
// which plugins are available.
// which plugins are available.
func
RegisterPlugin
(
plugin
Plugin
)
{
//
if
plugin
.
Name
==
""
{
// The plugin MUST have a name: lower case and one word.
// If this plugin has an action, it must be the name of
// the directive that invokes it. A name is always required
// and must be unique for the server type.
func
RegisterPlugin
(
name
string
,
plugin
Plugin
)
{
if
name
==
""
{
panic
(
"plugin must have a name"
)
panic
(
"plugin must have a name"
)
}
}
if
_
,
ok
:=
plugins
[
plugin
.
ServerType
];
!
ok
{
if
_
,
ok
:=
plugins
[
plugin
.
ServerType
];
!
ok
{
plugins
[
plugin
.
ServerType
]
=
make
(
map
[
string
]
Plugin
)
plugins
[
plugin
.
ServerType
]
=
make
(
map
[
string
]
Plugin
)
}
}
if
_
,
dup
:=
plugins
[
plugin
.
ServerType
][
plugin
.
N
ame
];
dup
{
if
_
,
dup
:=
plugins
[
plugin
.
ServerType
][
n
ame
];
dup
{
panic
(
"plugin named "
+
plugin
.
N
ame
+
" already registered for server type "
+
plugin
.
ServerType
)
panic
(
"plugin named "
+
n
ame
+
" already registered for server type "
+
plugin
.
ServerType
)
}
}
plugins
[
plugin
.
ServerType
][
plugin
.
N
ame
]
=
plugin
plugins
[
plugin
.
ServerType
][
n
ame
]
=
plugin
}
}
// RegisterParsingCallback registers callback to be called after
// RegisterParsingCallback registers callback to be called after
...
...
startupshutdown/startupshutdown.go
View file @
d3860f95
...
@@ -9,14 +9,8 @@ import (
...
@@ -9,14 +9,8 @@ import (
)
)
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"startup"
,
caddy
.
Plugin
{
Action
:
Startup
})
Name
:
"startup"
,
caddy
.
RegisterPlugin
(
"shutdown"
,
caddy
.
Plugin
{
Action
:
Shutdown
})
Action
:
Startup
,
})
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"shutdown"
,
Action
:
Shutdown
,
})
}
}
// Startup registers a startup callback to execute during server start.
// Startup registers a startup callback to execute during server start.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment