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
311624be
Commit
311624be
authored
Dec 28, 2015
by
Carl Bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3598 from eddawley/ISSUE-2818
Fixes #2818. Adds support for mysql backends via unix sockets
parents
69eb62c0
ec36e283
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
conf/defaults.ini
+3
-1
pkg/services/sqlstore/sqlstore.go
+7
-2
No files found.
conf/defaults.ini
View file @
311624be
...
...
@@ -79,7 +79,9 @@ provider = file
# file: session dir path, is relative to grafana data_path
# 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`
# mysql: go-sql-driver/mysql dsn config string, examples:
# `user:password@tcp(127.0.0.1:3306)/database_name`
# `user:password@unix(/var/run/mysqld/mysqld.sock)/database_name`
# memcache: 127.0.0.1:11211
...
...
pkg/services/sqlstore/sqlstore.go
View file @
311624be
...
...
@@ -113,8 +113,13 @@ func getEngine() (*xorm.Engine, error) {
cnnstr
:=
""
switch
DbCfg
.
Type
{
case
"mysql"
:
cnnstr
=
fmt
.
Sprintf
(
"%s:%s@tcp(%s)/%s?charset=utf8"
,
DbCfg
.
User
,
DbCfg
.
Pwd
,
DbCfg
.
Host
,
DbCfg
.
Name
)
protocol
:=
"tcp"
if
strings
.
HasPrefix
(
DbCfg
.
Host
,
"/"
)
{
protocol
=
"unix"
}
cnnstr
=
fmt
.
Sprintf
(
"%s:%s@%s(%s)/%s?charset=utf8"
,
DbCfg
.
User
,
DbCfg
.
Pwd
,
protocol
,
DbCfg
.
Host
,
DbCfg
.
Name
)
case
"postgres"
:
var
host
,
port
=
"127.0.0.1"
,
"5432"
fields
:=
strings
.
Split
(
DbCfg
.
Host
,
":"
)
...
...
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