mirror of
https://github.com/caddyserver/website.git
synced 2025-04-20 12:15:08 -04:00
Rename ID -> Name
This commit is contained in:
parent
f1ce3bee82
commit
76c09b8a9e
1 changed files with 9 additions and 9 deletions
|
@ -35,8 +35,8 @@ type Gizmo struct {
|
||||||
// CaddyModule returns the Caddy module information.
|
// CaddyModule returns the Caddy module information.
|
||||||
func (Gizmo) CaddyModule() caddy.ModuleInfo {
|
func (Gizmo) CaddyModule() caddy.ModuleInfo {
|
||||||
return caddy.ModuleInfo{
|
return caddy.ModuleInfo{
|
||||||
ID: "foo.gizmo",
|
Name: "foo.gizmo",
|
||||||
New: func() caddy.Module { return new(Gizmo) },
|
New: func() caddy.Module { return new(Gizmo) },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -51,17 +51,17 @@ import _ "github.com/example/mymodule"
|
||||||
|
|
||||||
Caddy modules:
|
Caddy modules:
|
||||||
|
|
||||||
1. Implement the `caddy.Module` interface to provide an ID and constructor
|
1. Implement the `caddy.Module` interface to provide a Name and constructor
|
||||||
2. Have a unique name in the proper namespace
|
2. Have a unique name in the proper namespace
|
||||||
3. Usually satisfy some interface(s) that are meaningful to the host module for that namespace
|
3. Usually satisfy some interface(s) that are meaningful to the host module for that namespace
|
||||||
|
|
||||||
The next sections explain how to satisfy these properties!
|
The next sections explain how to satisfy these properties!
|
||||||
|
|
||||||
## Module IDs
|
## Module Names
|
||||||
|
|
||||||
Each Caddy module has a unique ID, consisting of a namespace and name:
|
Each Caddy module has a unique Name, consisting of a namespace and name:
|
||||||
|
|
||||||
- A complete ID looks like `foo.bar.module_name`
|
- A complete Name looks like `foo.bar.module_name`
|
||||||
- The namespace would be `foo.bar`
|
- The namespace would be `foo.bar`
|
||||||
- The name would be `module_name` which must be unique in its namespace
|
- The name would be `module_name` which must be unique in its namespace
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ Each Caddy module has a unique ID, consisting of a namespace and name:
|
||||||
|
|
||||||
**Guest modules** (or _child modules_) are modules which get loaded or initialized. All modules are guest modules.
|
**Guest modules** (or _child modules_) are modules which get loaded or initialized. All modules are guest modules.
|
||||||
|
|
||||||
Module IDs must use `snake_case` convention.
|
Module Names must use `snake_case` convention.
|
||||||
|
|
||||||
### Namespaces
|
### Namespaces
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ The second field (`Gadget`) is where the final, provisioned value will eventuall
|
||||||
|
|
||||||
### Caddy struct tags
|
### Caddy struct tags
|
||||||
|
|
||||||
The `caddy` struct tag on the raw module field helps Caddy to know the namespace and name (comprising the complete ID) of the module to load. It is also used for generating documentation.
|
The `caddy` struct tag on the raw module field helps Caddy to know the namespace and name (comprising the complete Name) of the module to load. It is also used for generating documentation.
|
||||||
|
|
||||||
The struct tag has a very simple format: `key1=val1 key2=val2 ...`
|
The struct tag has a very simple format: `key1=val1 key2=val2 ...`
|
||||||
|
|
||||||
|
@ -372,4 +372,4 @@ var (
|
||||||
_ caddyhttp.MiddlewareHandler = (*Middleware)(nil)
|
_ caddyhttp.MiddlewareHandler = (*Middleware)(nil)
|
||||||
_ caddyfile.Unmarshaler = (*Middleware)(nil)
|
_ caddyfile.Unmarshaler = (*Middleware)(nil)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue