Skip to content

Commit

Permalink
Added more endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jul 16, 2019
1 parent ef9a04c commit 0448afc
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- Options can be changed with the command line argument
- Emojis
- More checks
- No need to run with `--privileged` although you bind mount the docker socket
- No networking, just unix socket files

Exposing `/var/run/docker.sock` to a Docker container requiring it (such as [netdata](https://github.com/firehol/netdata)) involves
security concerns and the container should be limited in what it can do with `docker.sock`.
Expand All @@ -42,6 +44,20 @@ You can enable an endpoint with the `-a` argument. Currently supported endpoints
- info: opens access to `/info`
- version: opens access to `/version`
- ping: opens access to `/_ping`
- Untested endpoints:
- events
- auth
- secrets
- build
- commit
- configs
- distribution
- exec
- nodes
- plugins
- session
- swarm
- system

To combine arguments, repeat them like this: `-a info -a version`

Expand Down
61 changes: 60 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,40 @@ func (s *stringSlice) Set(value string) error {
return nil
}

var allowedOptions = []string{"containers", "images", "networks", "volumes", "services", "tasks", "events", "info", "version", "ping"}
var allowedOptions = []string{
"containers", "images", "networks", "volumes",
"services", "tasks", "events", "info", "version",
"ping", "events", "auth", "secrets", "build", "commit",
"configs", "distribution", "exec", "nodes", "plugins",
"session", "swarm", "system",
}

case "events":
m.HandleFunc("/events", upstream.pass())
case "auth":
m.HandleFunc("/auth", upstream.pass())
case "secrets":
m.HandleFunc("/secrets", upstream.pass())
case "build":
m.HandleFunc("/build", upstream.pass())
case "commit":
m.HandleFunc("/commit", upstream.pass())
case "configs":
m.HandleFunc("/configs", upstream.pass())
case "distribution":
m.HandleFunc("/distribution", upstream.pass())
case "exec":
m.HandleFunc("/exec", upstream.pass())
case "nodes":
m.HandleFunc("/nodes", upstream.pass())
case "plugins":
m.HandleFunc("/plugins", upstream.pass())
case "session":
m.HandleFunc("/session", upstream.pass())
case "swarm":
m.HandleFunc("/swarm", upstream.pass())
case "system":
m.HandleFunc("/system", upstream.pass())

func main() {
fmt.Println("############################################")
Expand Down Expand Up @@ -143,6 +176,32 @@ func main() {
m.HandleFunc("/info", upstream.pass())
case "ping":
m.HandleFunc("/_ping", upstream.pass())
case "events":
m.HandleFunc("/events", upstream.pass())
case "auth":
m.HandleFunc("/auth", upstream.pass())
case "secrets":
m.HandleFunc("/secrets", upstream.pass())
case "build":
m.HandleFunc("/build", upstream.pass())
case "commit":
m.HandleFunc("/commit", upstream.pass())
case "configs":
m.HandleFunc("/configs", upstream.pass())
case "distribution":
m.HandleFunc("/distribution", upstream.pass())
case "exec":
m.HandleFunc("/exec", upstream.pass())
case "nodes":
m.HandleFunc("/nodes", upstream.pass())
case "plugins":
m.HandleFunc("/plugins", upstream.pass())
case "session":
m.HandleFunc("/session", upstream.pass())
case "swarm":
m.HandleFunc("/swarm", upstream.pass())
case "system":
m.HandleFunc("/system", upstream.pass())
}
}
}
Expand Down

0 comments on commit 0448afc

Please sign in to comment.