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
36f0bf0e
Commit
36f0bf0e
authored
Oct 03, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(web): Improve error message for invalid SSL configuration
parent
4a116ad4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
+23
-1
pkg/cmd/grafana-server/server.go
+23
-1
No files found.
pkg/cmd/grafana-server/server.go
View file @
36f0bf0e
...
...
@@ -7,6 +7,8 @@ import (
"os"
"time"
"gopkg.in/macaron.v1"
"golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/api"
...
...
@@ -89,7 +91,7 @@ func (g *GrafanaServerImpl) startHttpServer() {
case
setting
.
HTTP
:
err
=
http
.
ListenAndServe
(
listenAddr
,
m
)
case
setting
.
HTTPS
:
err
=
http
.
ListenAndServeTLS
(
listenAddr
,
setting
.
CertFile
,
setting
.
KeyFile
,
m
)
err
=
ListenAndServeTLS
(
listenAddr
,
setting
.
CertFile
,
setting
.
KeyFile
,
m
)
default
:
g
.
log
.
Error
(
"Invalid protocol"
,
"protocol"
,
setting
.
Protocol
)
g
.
Shutdown
(
1
,
"Startup failed"
)
...
...
@@ -113,6 +115,26 @@ func (g *GrafanaServerImpl) Shutdown(code int, reason string) {
os
.
Exit
(
code
)
}
func
ListenAndServeTLS
(
listenAddr
,
certfile
,
keyfile
string
,
m
*
macaron
.
Macaron
)
error
{
if
certfile
==
""
{
return
fmt
.
Errorf
(
"cert_file cannot be empty when using HTTPS"
)
}
if
keyfile
==
""
{
return
fmt
.
Errorf
(
"cert_key cannot be empty when using HTTPS"
)
}
if
_
,
err
:=
os
.
Stat
(
setting
.
CertFile
);
os
.
IsNotExist
(
err
)
{
return
fmt
.
Errorf
(
`Cannot find SSL cert_file at %v`
,
setting
.
CertFile
)
}
if
_
,
err
:=
os
.
Stat
(
setting
.
KeyFile
);
os
.
IsNotExist
(
err
)
{
return
fmt
.
Errorf
(
`Cannot find SSL key_file at %v`
,
setting
.
KeyFile
)
}
return
http
.
ListenAndServeTLS
(
listenAddr
,
setting
.
CertFile
,
setting
.
KeyFile
,
m
)
}
// implement context.Context
func
(
g
*
GrafanaServerImpl
)
Deadline
()
(
deadline
time
.
Time
,
ok
bool
)
{
return
g
.
context
.
Deadline
()
...
...
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