Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
64124b50
Commit
64124b50
authored
Jan 22, 2019
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add setting for how to long we should keep expired tokens
parent
d3ec8e1c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
conf/defaults.ini
+6
-3
pkg/services/auth/session_cleanup.go
+1
-1
pkg/setting/setting.go
+5
-3
No files found.
conf/defaults.ini
View file @
64124b50
...
...
@@ -110,18 +110,21 @@ cache_mode = private
[login]
#
l
ogin cookie name
#
L
ogin cookie name
cookie_name
=
grafana_session
# If you want login cookies to be https only. default is false
cookie_secure
=
false
#
l
ogged in user name
#
L
ogged in user name
cookie_username
=
grafana_user
#
h
ow many days an session can be unused before we inactivate it
#
H
ow many days an session can be unused before we inactivate it
login_remember_days
=
7
# How long should Grafana keep expired tokens before deleting them
delete_expired_token_after_days
=
30
#################################### Session #############################
[session]
# Either "memory", "file", "redis", "mysql", "postgres", "memcache", default is "file"
...
...
pkg/services/auth/session_cleanup.go
View file @
64124b50
...
...
@@ -7,7 +7,7 @@ import (
func
(
srv
*
UserAuthTokenServiceImpl
)
Run
(
ctx
context
.
Context
)
error
{
ticker
:=
time
.
NewTicker
(
time
.
Hour
*
12
)
deleteSessionAfter
:=
time
.
Hour
*
24
*
7
*
30
deleteSessionAfter
:=
time
.
Hour
*
24
*
time
.
Duration
(
srv
.
Cfg
.
LoginDeleteExpiredTokensAfterDays
)
for
{
select
{
...
...
pkg/setting/setting.go
View file @
64124b50
...
...
@@ -228,6 +228,7 @@ type Cfg struct {
LoginCookieUsername
string
LoginCookieSecure
bool
LoginCookieMaxDays
int
LoginDeleteExpiredTokensAfterDays
int
}
type
CommandLineArgs
struct
{
...
...
@@ -553,10 +554,11 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
//login
login
:=
iniFile
.
Section
(
"login"
)
cfg
.
LoginCookieName
=
login
.
Key
(
"cookie_name"
)
.
String
(
)
cfg
.
LoginCookieMaxDays
=
login
.
Key
(
"login_remember_days"
)
.
MustInt
()
cfg
.
LoginCookieName
=
login
.
Key
(
"cookie_name"
)
.
MustString
(
"grafana_session"
)
cfg
.
LoginCookieMaxDays
=
login
.
Key
(
"login_remember_days"
)
.
MustInt
(
7
)
cfg
.
LoginCookieSecure
=
login
.
Key
(
"cookie_secure"
)
.
MustBool
(
false
)
cfg
.
LoginCookieUsername
=
login
.
Key
(
"cookie_username"
)
.
String
()
cfg
.
LoginCookieUsername
=
login
.
Key
(
"cookie_username"
)
.
MustString
(
"grafana_username"
)
cfg
.
LoginDeleteExpiredTokensAfterDays
=
login
.
Key
(
"delete_expired_token_after_days"
)
.
MustInt
(
30
)
Env
=
iniFile
.
Section
(
""
)
.
Key
(
"app_mode"
)
.
MustString
(
"development"
)
InstanceName
=
iniFile
.
Section
(
""
)
.
Key
(
"instance_name"
)
.
MustString
(
"unknown_instance_name"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment