mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 15:45:43 -06:00
Add memcache as session provider
This commit is contained in:
parent
d7ee7cb88f
commit
ed16914715
@ -67,7 +67,7 @@ path = grafana.db
|
||||
|
||||
#################################### Session ####################################
|
||||
[session]
|
||||
# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
|
||||
# Either "memory", "file", "redis", "mysql", "postgres", "memcache", default is "file"
|
||||
provider = file
|
||||
|
||||
# Provider config options
|
||||
@ -76,6 +76,8 @@ provider = file
|
||||
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
|
||||
# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
|
||||
# mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
|
||||
# memcache: 127.0.0.1:11211
|
||||
|
||||
|
||||
provider_config = sessions
|
||||
|
||||
|
@ -355,7 +355,7 @@ Set to `true` to enable auto sign up of users who do not exist in Grafana DB. De
|
||||
|
||||
### provider
|
||||
|
||||
Valid values are `memory`, `file`, `mysql`, `postgres`. Default is `file`.
|
||||
Valid values are `memory`, `file`, `mysql`, `postgres`, `memcache`. Default is `file`.
|
||||
|
||||
### provider_config
|
||||
|
||||
@ -365,6 +365,7 @@ session provider you have configured.
|
||||
- **file:** session file path, e.g. `data/sessions`
|
||||
- **mysql:** go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
|
||||
- **postgres:** ex: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
|
||||
- **memcache:** ex: 127.0.0.1:11211
|
||||
|
||||
If you use MySQL or Postgres as the session store you need to create the
|
||||
session table manually.
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
_ "github.com/macaron-contrib/session/mysql"
|
||||
_ "github.com/macaron-contrib/session/postgres"
|
||||
_ "github.com/macaron-contrib/session/redis"
|
||||
_ "github.com/macaron-contrib/session/memcache"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -473,7 +473,7 @@ func NewConfigContext(args *CommandLineArgs) error {
|
||||
func readSessionConfig() {
|
||||
sec := Cfg.Section("session")
|
||||
SessionOptions = session.Options{}
|
||||
SessionOptions.Provider = sec.Key("provider").In("memory", []string{"memory", "file", "redis", "mysql", "postgres"})
|
||||
SessionOptions.Provider = sec.Key("provider").In("memory", []string{"memory", "file", "redis", "mysql", "postgres", "memcache"})
|
||||
SessionOptions.ProviderConfig = strings.Trim(sec.Key("provider_config").String(), "\" ")
|
||||
SessionOptions.CookieName = sec.Key("cookie_name").MustString("grafana_sess")
|
||||
SessionOptions.CookiePath = AppSubUrl
|
||||
|
Loading…
Reference in New Issue
Block a user