Skip to content

Commit

Permalink
Add a heartbeat mechanism, and timeouts support (#53)
Browse files Browse the repository at this point in the history
* Add a hearthbeat mechanism, and timeouts support

* Fix typo...

* Bump dependencies
  • Loading branch information
dunglas authored Mar 8, 2019
1 parent 802628b commit a65ad86
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 23 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ LOG_FORMAT=JSON
PUBLISH_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000
PUBLISHER_JWT_KEY=
SUBSCRIBER_JWT_KEY=
HEARTBEAT_INTERVAL=10s
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- '1.11'
- '1.12'

env:
- GO111MODULE=on
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,14 @@ Be sure to update the value of `ACME_HOSTS` to match your domain name(s), a Let'
* `DB_PATH`: the path of the [bbolt](https://github.com/etcd-io/bbolt) database (default to `updates.db` in the current directory)
* `DEBUG`: set to `1` to enable the debug mode (prints recovery stack traces)
* `DEMO`: set to `1` to enable the demo mode (automatically enabled when `DEBUG=1`)
* `HEARTBEAT_INTERVAL`: interval between heartbeats (useful with some proxies, and old browsers), set to `0s` to disable (default), example `15s`
* `JWT_KEY`: the JWT key to use for both publishers and subscribers
* `LOG_FORMAT`: the log format, can be `JSON`, `FLUENTD` or `TEXT` (default)
* `PUBLISH_ALLOWED_ORIGINS`: a comma separated list of origins allowed to publish (only applicable when using cookie-based auth)
* `PUBLISHER_JWT_KEY`: must contain the secret key to valid publishers' JWT, can be omited if `JWT_KEY` is set
* `READ_TIMEOUT`: maximum duration for reading the entire request, including the body, set to `0` to disable (default), example: `2m`
* `SUBSCRIBER_JWT_KEY`: must contain the secret key to valid subscribers' JWT, can be omited if `JWT_KEY` is set
* `WRITE_TIMEOUT`: maximum duration before timing out writes of the response, set to `0` to disable (default), example: `2m`

If `ACME_HOSTS` or both `CERT_FILE` and `CERT_KEY` are provided, an HTTPS server supporting HTTP/2 connection will be started.
If not, an HTTP server will be started (**not secure**).
Expand Down
74 changes: 61 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,75 @@
module github.com/dunglas/mercure

require (
cloud.google.com/go v0.36.0 // indirect
dmitri.shuralyov.com/app/changes v0.0.0-20181114035150-5af16e21babb // indirect
dmitri.shuralyov.com/service/change v0.0.0-20190301072032-c25fb47d71b3 // indirect
github.com/Shopify/sarama v1.21.0 // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/codegangsta/negroni v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/coreos/go-systemd v0.0.0-20190212144455-93d5ec2c7f76 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/gliderlabs/ssh v0.1.3 // indirect
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/lint v0.0.0-20190301231843-5614ed5bae6f // indirect
github.com/golang/protobuf v1.3.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/pprof v0.0.0-20190228041337-2ef8d84b2e3c // indirect
github.com/googleapis/gax-go v2.0.2+incompatible // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.6.2
github.com/gorilla/mux v1.7.0
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/grpc-ecosystem/grpc-gateway v1.8.2 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/joho/godotenv v1.3.0
github.com/joonix/log v0.0.0-20180502111528-d2d3f2f4a806
github.com/kr/pretty v0.1.0 // indirect
github.com/joonix/log v0.0.0-20190213172830-51a6cca1fed3
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/goveralls v0.0.2 // indirect
github.com/onsi/gomega v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/microcosm-cc/bluemonday v1.0.2 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/openzipkin/zipkin-go v0.1.5 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/procfs v0.0.0-20190306233201-d0f344d83b0c // indirect
github.com/rogpeppe/fastuuid v1.0.0 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/satori/go.uuid v1.2.1-0.20180103174451-36e9d2ebbde5
github.com/sirupsen/logrus v1.0.6
github.com/stretchr/testify v1.2.2
github.com/unrolled/secure v0.0.0-20180914162101-439d7b25425f
github.com/shurcooL/go v0.0.0-20190121191506-3fef8c783dec // indirect
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d // indirect
github.com/shurcooL/highlight_diff v0.0.0-20181222201841-111da2e7d480 // indirect
github.com/shurcooL/highlight_go v0.0.0-20181215221002-9d8641ddf2e1 // indirect
github.com/shurcooL/home v0.0.0-20190204141146-5c8ae21d4240 // indirect
github.com/shurcooL/htmlg v0.0.0-20190120222857-1e8a37b806f3 // indirect
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414 // indirect
github.com/shurcooL/issues v0.0.0-20190120000219-08d8dadf8acb // indirect
github.com/shurcooL/issuesapp v0.0.0-20181229001453-b8198a402c58 // indirect
github.com/shurcooL/notifications v0.0.0-20181111060504-bcc2b3082a7a // indirect
github.com/shurcooL/octicon v0.0.0-20181222203144-9ff1a4cf27f4 // indirect
github.com/shurcooL/reactions v0.0.0-20181222204718-145cd5e7f3d1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/shurcooL/webdavfs v0.0.0-20181215192745-5988b2d638f6 // indirect
github.com/sirupsen/logrus v1.3.0
github.com/stretchr/testify v1.3.0
github.com/unrolled/secure v1.0.0
github.com/yosida95/uritemplate v0.0.0-20170413134207-5c22f358020b
go.etcd.io/bbolt v1.3.0
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09 // indirect
go.etcd.io/bbolt v1.3.2
go.opencensus.io v0.19.1 // indirect
go4.org v0.0.0-20190218023631-ce4c26f7be8e // indirect
golang.org/x/build v0.0.0-20190307215223-c78805dbabc8 // indirect
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 // indirect
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f // indirect
golang.org/x/net v0.0.0-20190301231341-16b79f2e4e95 // indirect
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 // indirect
golang.org/x/perf v0.0.0-20190306144031-151b6387e3f2 // indirect
golang.org/x/sys v0.0.0-20190308023053-584f3b12f43e // indirect
golang.org/x/tools v0.0.0-20190308142131-b40df0fb21c3 // indirect
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
honnef.co/go/tools v0.0.0-20190215041234-466a0476246c // indirect
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
)
Loading

0 comments on commit a65ad86

Please # to comment.