Skip to content

Commit

Permalink
sql: limit maximum open connections, document timeout options through…
Browse files Browse the repository at this point in the history
… DSN

Closes #359
  • Loading branch information
Aeneas Rekkas (arekkas) authored and arekkas committed May 7, 2017
1 parent d9ae845 commit fa8d15c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
17 changes: 8 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ type Config struct {
CookieSecret string `mapstructure:"COOKIE_SECRET" yaml:"-"`
ForceHTTP bool `yaml:"-"`

Logger *logrus.Logger

cluster *url.URL `yaml:"-"`
oauth2Client *http.Client `yaml:"-"`
context *Context `yaml:"-"`
systemSecret []byte
logger *logrus.Logger `yaml:"-"`
cluster *url.URL `yaml:"-"`
oauth2Client *http.Client `yaml:"-"`
context *Context `yaml:"-"`
systemSecret []byte
}

func matchesRange(r *http.Request, ranges []string) error {
Expand Down Expand Up @@ -96,11 +95,11 @@ func newLogger() *logrus.Logger {
}

func (c *Config) GetLogger() *logrus.Logger {
if c.Logger == nil {
c.Logger = newLogger()
if c.logger == nil {
c.logger = newLogger()
}

return c.Logger
return c.logger
}

func (c *Config) DoesRequestSatisfyTermination(r *http.Request) error {
Expand Down
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* [Architecture and Design](contribute.md)
* [Running Tests](contribute.md)
* [FAQ](faq.md)
* [How can I control SQL connection limits?](faq/sql.md)
* [Where is the HTTP API Documentation?](faq/http-api.md)
* [How can I disable HTTPS for testing?](faq/disable-https.md)
* [How can I import TLS certificates?](faq/https-tls-import.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/faq/sql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## How can I control SQL connection limits?

You can configure SQL connection limits by appending parameters `max_conns`, `max_idle_conns`, or `max_conn_lifetime`
to the DSN: `postgres://foo:bar@host:port/database?max_conns=12`.

0 comments on commit fa8d15c

Please sign in to comment.