Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make registration endpoint URI configurable #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ header_name = "X-Forwarded-For"


## Changelog
- unreleased
- New
- Registration URI configurable
- v0.5
- New
- Configurable certificate cache directory
Expand Down
2 changes: 2 additions & 0 deletions config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ api_domain = ""
ip = "0.0.0.0"
# disable registration endpoint
disable_registration = false
# endpoint URI for registration
#registration_uri = "/register"
# autocert HTTP port, eg. 80 for answering Let's Encrypt HTTP-01 challenges. Mandatory if using tls = "letsencrypt".
autocert_port = "80"
# listen port, eg. 443 for default HTTPS
Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ func startHTTPAPI() {
c.Log = stdlog.New(logwriter, "", 0)
}
if !Config.API.DisableRegistration {
api.POST("/register", webRegisterPost)
uri := Config.API.RegistrationUri
if (uri == "") {
uri = "/register"
}
log.WithFields(log.Fields{"register_uri": uri}).Debug("Register endpoint")
api.POST(uri, webRegisterPost)
}
api.POST("/update", Auth(webUpdatePost))

Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type httpapi struct {
Domain string `toml:"api_domain"`
IP string
DisableRegistration bool `toml:"disable_registration"`
RegistrationUri string `toml:"registration_uri"`
AutocertPort string `toml:"autocert_port"`
Port string `toml:"port"`
TLS string
Expand Down