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
Hide 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 (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"basicauth"
,
caddy
.
RegisterPlugin
(
"basicauth"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/bind/bind.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"bind"
,
caddy
.
RegisterPlugin
(
"bind"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setupBind
,
})
...
...
caddyhttp/browse/setup.go
View file @
d3860f95
...
...
@@ -11,8 +11,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"browse"
,
caddy
.
RegisterPlugin
(
"browse"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/errors/errors.go
View file @
d3860f95
...
...
@@ -16,8 +16,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"errors"
,
caddy
.
RegisterPlugin
(
"errors"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/expvar/setup.go
View file @
d3860f95
...
...
@@ -10,8 +10,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"expvar"
,
caddy
.
RegisterPlugin
(
"expvar"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/extensions/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"ext"
,
caddy
.
RegisterPlugin
(
"ext"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/fastcgi/setup.go
View file @
d3860f95
...
...
@@ -10,8 +10,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"fastcgi"
,
caddy
.
RegisterPlugin
(
"fastcgi"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/gzip/gzip.go
View file @
d3860f95
...
...
@@ -17,8 +17,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"gzip"
,
caddy
.
RegisterPlugin
(
"gzip"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/header/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"header"
,
caddy
.
RegisterPlugin
(
"header"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/internalsrv/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"internal"
,
caddy
.
RegisterPlugin
(
"internal"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/log/log.go
View file @
d3860f95
...
...
@@ -11,8 +11,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"log"
,
caddy
.
RegisterPlugin
(
"log"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/markdown/setup.go
View file @
d3860f95
...
...
@@ -10,8 +10,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"markdown"
,
caddy
.
RegisterPlugin
(
"markdown"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/mime/setup.go
View file @
d3860f95
...
...
@@ -9,8 +9,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"mime"
,
caddy
.
RegisterPlugin
(
"mime"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/pprof/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"pprof"
,
caddy
.
RegisterPlugin
(
"pprof"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/proxy/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"proxy"
,
caddy
.
RegisterPlugin
(
"proxy"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/redirect/setup.go
View file @
d3860f95
...
...
@@ -8,8 +8,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"redir"
,
caddy
.
RegisterPlugin
(
"redir"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/rewrite/setup.go
View file @
d3860f95
...
...
@@ -10,8 +10,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"rewrite"
,
caddy
.
RegisterPlugin
(
"rewrite"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/root/root.go
View file @
d3860f95
...
...
@@ -9,8 +9,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"root"
,
caddy
.
RegisterPlugin
(
"root"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setupRoot
,
})
...
...
caddyhttp/templates/setup.go
View file @
d3860f95
...
...
@@ -8,8 +8,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"templates"
,
caddy
.
RegisterPlugin
(
"templates"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddyhttp/websocket/setup.go
View file @
d3860f95
...
...
@@ -6,8 +6,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"websocket"
,
caddy
.
RegisterPlugin
(
"websocket"
,
caddy
.
Plugin
{
ServerType
:
"http"
,
Action
:
setup
,
})
...
...
caddytls/setup.go
View file @
d3860f95
...
...
@@ -16,10 +16,7 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"tls"
,
Action
:
setupTLS
,
})
caddy
.
RegisterPlugin
(
"tls"
,
caddy
.
Plugin
{
Action
:
setupTLS
})
}
// setupTLS sets up the TLS configuration and installs certificates that
...
...
plugins.go
View file @
d3860f95
...
...
@@ -135,11 +135,6 @@ type ServerType struct {
// Plugin is a type which holds information about a plugin.
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.
// Can be empty if not applicable, or if the plugin
// can associate with any server type.
...
...
@@ -154,17 +149,22 @@ type Plugin struct {
// themselves, even if they do not perform an action associated
// with a directive. It is important for the process to know
// 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"
)
}
if
_
,
ok
:=
plugins
[
plugin
.
ServerType
];
!
ok
{
plugins
[
plugin
.
ServerType
]
=
make
(
map
[
string
]
Plugin
)
}
if
_
,
dup
:=
plugins
[
plugin
.
ServerType
][
plugin
.
N
ame
];
dup
{
panic
(
"plugin named "
+
plugin
.
N
ame
+
" already registered for server type "
+
plugin
.
ServerType
)
if
_
,
dup
:=
plugins
[
plugin
.
ServerType
][
n
ame
];
dup
{
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
...
...
startupshutdown/startupshutdown.go
View file @
d3860f95
...
...
@@ -9,14 +9,8 @@ import (
)
func
init
()
{
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"startup"
,
Action
:
Startup
,
})
caddy
.
RegisterPlugin
(
caddy
.
Plugin
{
Name
:
"shutdown"
,
Action
:
Shutdown
,
})
caddy
.
RegisterPlugin
(
"startup"
,
caddy
.
Plugin
{
Action
:
Startup
})
caddy
.
RegisterPlugin
(
"shutdown"
,
caddy
.
Plugin
{
Action
:
Shutdown
})
}
// 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