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
f147ac05
Commit
f147ac05
authored
Feb 10, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'huydx-feat/sqlmax'
parents
3c7cf3f7
5b7b3fef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletions
+26
-1
conf/defaults.ini
+5
-0
conf/sample.ini
+6
-0
pkg/services/sqlstore/sqlstore.go
+15
-1
No files found.
conf/defaults.ini
View file @
f147ac05
...
@@ -73,6 +73,11 @@ password =
...
@@ -73,6 +73,11 @@ password =
# Example: mysql://user:secret@host:port/database
# Example: mysql://user:secret@host:port/database
url
=
url
=
# Max conn setting default is 0 (mean not set)
max_conn
=
max_idle_conn
=
max_open_conn
=
# For "postgres", use either "disable", "require" or "verify-full"
# For "postgres", use either "disable", "require" or "verify-full"
# For "mysql", use either "true", "false", or "skip-verify".
# For "mysql", use either "true", "false", or "skip-verify".
ssl_mode
=
disable
ssl_mode
=
disable
...
...
conf/sample.ini
View file @
f147ac05
...
@@ -82,6 +82,12 @@
...
@@ -82,6 +82,12 @@
# For "sqlite3" only, path relative to data_path setting
# For "sqlite3" only, path relative to data_path setting
;path = grafana.db
;path = grafana.db
# Max conn setting default is 0 (mean not set)
;max_conn =
;max_idle_conn =
;max_open_conn =
#################################### Session ####################################
#################################### Session ####################################
[session]
[session]
# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
...
...
pkg/services/sqlstore/sqlstore.go
View file @
f147ac05
...
@@ -29,6 +29,9 @@ type DatabaseConfig struct {
...
@@ -29,6 +29,9 @@ type DatabaseConfig struct {
ClientKeyPath
string
ClientKeyPath
string
ClientCertPath
string
ClientCertPath
string
ServerCertName
string
ServerCertName
string
MaxConn
int
MaxOpenConn
int
MaxIdleConn
int
}
}
var
(
var
(
...
@@ -150,7 +153,15 @@ func getEngine() (*xorm.Engine, error) {
...
@@ -150,7 +153,15 @@ func getEngine() (*xorm.Engine, error) {
}
}
sqlog
.
Info
(
"Initializing DB"
,
"dbtype"
,
DbCfg
.
Type
)
sqlog
.
Info
(
"Initializing DB"
,
"dbtype"
,
DbCfg
.
Type
)
return
xorm
.
NewEngine
(
DbCfg
.
Type
,
cnnstr
)
engine
,
err
:=
xorm
.
NewEngine
(
DbCfg
.
Type
,
cnnstr
)
if
err
!=
nil
{
return
nil
,
err
}
else
{
engine
.
SetMaxConns
(
DbCfg
.
MaxConn
)
engine
.
SetMaxOpenConns
(
DbCfg
.
MaxOpenConn
)
engine
.
SetMaxIdleConns
(
DbCfg
.
MaxIdleConn
)
}
return
engine
,
nil
}
}
func
LoadConfig
()
{
func
LoadConfig
()
{
...
@@ -177,6 +188,9 @@ func LoadConfig() {
...
@@ -177,6 +188,9 @@ func LoadConfig() {
DbCfg
.
Host
=
sec
.
Key
(
"host"
)
.
String
()
DbCfg
.
Host
=
sec
.
Key
(
"host"
)
.
String
()
DbCfg
.
Name
=
sec
.
Key
(
"name"
)
.
String
()
DbCfg
.
Name
=
sec
.
Key
(
"name"
)
.
String
()
DbCfg
.
User
=
sec
.
Key
(
"user"
)
.
String
()
DbCfg
.
User
=
sec
.
Key
(
"user"
)
.
String
()
DbCfg
.
MaxConn
=
sec
.
Key
(
"max_conn"
)
.
MustInt
(
0
)
DbCfg
.
MaxOpenConn
=
sec
.
Key
(
"max_open_conn"
)
.
MustInt
(
0
)
DbCfg
.
MaxIdleConn
=
sec
.
Key
(
"max_idle_conn"
)
.
MustInt
(
0
)
if
len
(
DbCfg
.
Pwd
)
==
0
{
if
len
(
DbCfg
.
Pwd
)
==
0
{
DbCfg
.
Pwd
=
sec
.
Key
(
"password"
)
.
String
()
DbCfg
.
Pwd
=
sec
.
Key
(
"password"
)
.
String
()
}
}
...
...
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